texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * info/scan.c (write_tag_contents): Check if adde


From: Gavin D. Smith
Subject: branch master updated: * info/scan.c (write_tag_contents): Check if added text is of zero length in order to avoid subsequently calling memcpy with a null source argument. Report with -fsanitize=undefined on amd64 from Sam James <address@hidden>.
Date: Sat, 04 Nov 2023 06:40:30 -0400

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new b8200f940c * info/scan.c (write_tag_contents): Check if added text is 
of zero length in order to avoid subsequently calling memcpy with a null source 
argument.  Report with -fsanitize=undefined on amd64 from Sam James 
<sam@gentoo.org>.
b8200f940c is described below

commit b8200f940cd76bb44ae2aa67b9ea002b5aa746cf
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Nov 4 10:38:48 2023 +0000

    * info/scan.c (write_tag_contents): Check if added text is of
    zero length in order to avoid subsequently calling memcpy with
    a null source argument.  Report with -fsanitize=undefined on amd64
    from Sam James <sam@gentoo.org>.
---
 ChangeLog   | 7 +++++++
 info/scan.c | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 34596b8f70..1987470ed5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-11-04  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * info/scan.c (write_tag_contents): Check if added text is of
+       zero length in order to avoid subsequently calling memcpy with
+       a null source argument.  Report with -fsanitize=undefined on amd64
+       from Sam James <sam@gentoo.org>.
+
 2023-11-03  Gavin Smith <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/XS/Makefile.am: Make files depend on
diff --git a/info/scan.c b/info/scan.c
index d6183ae9ae..bdf272f9bf 100644
--- a/info/scan.c
+++ b/info/scan.c
@@ -925,11 +925,11 @@ write_extra_bytes_to_output (char *input, long n)
 }
 
 /* Like write_extra_bytes_to_output, but writes bytes even when
-   preprocess_nodes=Off. */
+   preprocess_nodes=Off.  Note n could be 0 for an index tag. */
 static void
 write_tag_contents (char *input, long n)
 {
-  if (rewrite_p)
+  if (rewrite_p && n > 0)
     {
       text_buffer_add_string (&output_buf, input, n);
       output_bytes_difference -= n;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]