diff options
Diffstat (limited to 'sys-apps/texinfo/files/7.1/0003-info-scan.c-write_tag_contents-Check-if-added-text-i.patch')
-rw-r--r-- | sys-apps/texinfo/files/7.1/0003-info-scan.c-write_tag_contents-Check-if-added-text-i.patch | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/sys-apps/texinfo/files/7.1/0003-info-scan.c-write_tag_contents-Check-if-added-text-i.patch b/sys-apps/texinfo/files/7.1/0003-info-scan.c-write_tag_contents-Check-if-added-text-i.patch new file mode 100644 index 000000000000..b3fbc85f461b --- /dev/null +++ b/sys-apps/texinfo/files/7.1/0003-info-scan.c-write_tag_contents-Check-if-added-text-i.patch @@ -0,0 +1,51 @@ +https://lists.gnu.org/archive/html/bug-texinfo/2023-11/msg00001.html + +From 12ad80f3a1cfa78c8a7b3a45458df7e07251317d Mon Sep 17 00:00:00 2001 +From: Gavin Smith <gavinsmith0123@gmail.com> +Date: Sat, 4 Nov 2023 10:38:48 +0000 +Subject: [PATCH 3/5] * 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 3d13a15517..efbb3b22d1 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-10-25 Eli Zaretskii <eliz@gnu.org> + + * tp/Texinfo/XS/xspara.c (xspara__add_next): Do not pass +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; +-- +2.42.1 + |