lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

gettext: backport upstream memory safety fix

This fixes building perlPackages.Po4a on musl. While we haven't seen
it with Glibc, I have no reason to believe the bug is musl-specific.

Fixes: 74042ae1cd5b ("gettext: 0.22.5 -> 0.25")

+45
+1
pkgs/development/libraries/gettext/default.nix
··· 25 25 # fix reproducibile output, in particular in the grub2 build 26 26 # https://savannah.gnu.org/bugs/index.php?59658 27 27 ./0001-msginit-Do-not-use-POT-Creation-Date.patch 28 + ./memory-safety.patch 28 29 ]; 29 30 30 31 outputs = [
+44
pkgs/development/libraries/gettext/memory-safety.patch
··· 1 + From: Bruno Haible <bruno@clisp.org> 2 + Date: Mon, 7 Jul 2025 07:02:41 +0000 (+0200) 3 + Subject: xgettext: Perl: Fix bug with comment lines longer than 1024 (regr. 2024-09-26). 4 + X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff_plain;h=f98de965a08d1883a46ba5411922b54cc5125f14 5 + 6 + xgettext: Perl: Fix bug with comment lines longer than 1024 (regr. 2024-09-26). 7 + 8 + Reported by Alyssa Ross <hi@alyssa.is> in 9 + <https://lists.gnu.org/archive/html/bug-gettext/2025-07/msg00009.html>. 10 + 11 + * gettext-tools/src/x-perl.c (phase2_getc): Move the sb_free call until after 12 + the savable_comment_add call. 13 + --- 14 + 15 + diff --git a/gettext-tools/src/x-perl.c b/gettext-tools/src/x-perl.c 16 + index d3aa50476..312fef371 100644 17 + --- a/gettext-tools/src/x-perl.c 18 + +++ b/gettext-tools/src/x-perl.c 19 + @@ -558,7 +558,6 @@ phase2_getc (struct perl_extractor *xp) 20 + { 21 + int lineno; 22 + int c; 23 + - char *utf8_string; 24 + 25 + c = phase1_getc (xp); 26 + if (c == '#') 27 + @@ -587,12 +586,13 @@ phase2_getc (struct perl_extractor *xp) 28 + sb_xappend1 (&buffer, c); 29 + } 30 + /* Convert it to UTF-8. */ 31 + - utf8_string = 32 + - from_current_source_encoding (sb_xcontents_c (&buffer), lc_comment, 33 + + const char *contents = sb_xcontents_c (&buffer); 34 + + char *utf8_contents = 35 + + from_current_source_encoding (contents, lc_comment, 36 + logical_file_name, lineno); 37 + - sb_free (&buffer); 38 + /* Save it until we encounter the corresponding string. */ 39 + - savable_comment_add (utf8_string); 40 + + savable_comment_add (utf8_contents); 41 + + sb_free (&buffer); 42 + xp->last_comment_line = lineno; 43 + } 44 + return c;