> Date: Sun, 08 Oct 2023 12:41:19 +0300 > From: Eli Zaretskii <e...@gnu.org> > Cc: bug-texinfo@gnu.org > > Starting program: d:\usr\Perl\bin\perl.exe ../tp/texi2any.pl info-stnd.texi > > Program received signal SIGSEGV, Segmentation fault. > 0x692a6fc6 in getdelim () > from D:\gnu\texinfo-7.0.93\tp\Texinfo\XS\.libs\Parsetexi.dll > (gdb) bt > #0 0x692a6fc6 in getdelim () > from D:\gnu\texinfo-7.0.93\tp\Texinfo\XS\.libs\Parsetexi.dll > #1 0x6928c993 in next_text () > from D:\gnu\texinfo-7.0.93\tp\Texinfo\XS\.libs\Parsetexi.dll > #2 0x6928ba6a in parse_texi () > from D:\gnu\texinfo-7.0.93\tp\Texinfo\XS\.libs\Parsetexi.dll > #3 0x6928bc58 in parse_texi_document () > from D:\gnu\texinfo-7.0.93\tp\Texinfo\XS\.libs\Parsetexi.dll > #4 0x692840d0 in parse_file () > from D:\gnu\texinfo-7.0.93\tp\Texinfo\XS\.libs\Parsetexi.dll > #5 0x6928219c in XS_Texinfo__Parser_parse_file () > from D:\gnu\texinfo-7.0.93\tp\Texinfo\XS\.libs\Parsetexi.dll > #6 0x66c8b8bb in perl520!Perl_find_runcv () from > d:\usr\Perl\bin\perl520.dll > > Source code information is not available in the debug info, but from > looking at the disassembly of the code, I see that getdelim (from > Gnulib) calls realloc, which resolves to the default realloc > implementation of the MinGW libc. Isn't that dangerous, given that at > least some code in the extensions uses the Perl's malloc/free > implementation?
Sorry, I was mistaken: the Gnulib getdelim is not used here. Instead, this build uses the MinGW implementation of getdelim, and that one has a subtle bug, which rears its ugly head because the second argument to getline, here: status = getline (&line, &n, input_file); is not initialized to any value. The simple fix below avoids the crash and allows the build to run to completion: --- tp/Texinfo/XS/parsetexi/input.c~ 2023-08-14 23:12:04.000000000 +0300 +++ tp/Texinfo/XS/parsetexi/input.c 2023-10-08 14:35:33.142000000 +0300 @@ -395,7 +395,7 @@ next_text (ELEMENT *current) { ssize_t status; char *line = 0; - size_t n; + size_t n = 120; FILE *input_file; if (input_pushback_string)