From 569d4c7ad60ec84e69df02f74e0c013ff83b93c2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 31 May 2022 01:19:32 -0700 Subject: [PATCH] Be more robust if doc file is corrupted MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * src/doc.c (Fsnarf_documentation): Don’t dump core on a corrupted doc file. Problem found by GCC 12 -Wanalyzer-null-argument. --- src/doc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/doc.c b/src/doc.c index 71e66853b08..14db3189f34 100644 --- a/src/doc.c +++ b/src/doc.c @@ -569,6 +569,8 @@ the same file name is found in the `doc-directory'. */) if (p) { end = strchr (p, '\n'); + if (!end) + error ("DOC file invalid at position %"pI"d", pos); /* We used to skip files not in build_files, so that when a function was defined several times in different files -- 2.39.2