The build of 5.2.2 is failing the current Ubuntu serie
https://launchpadlibrarian.net/721167206/buildlog_ubuntu-noble-amd64.giflib_5.2.2-1_BUILDING.txt.gz
A git checkout has the same issue
$ ./giftext pic/fire.gif
pic/fire.gif:
Screen Size - Width = 30, Height = 60.
ColorResolution = 8, BitsPerPixel = 8, BackGround = 0, Aspect = 0.
Has Global Color Map.
GIF89 application block (Ext Code = 255 [ ]):
GIF89 comment (Ext Code = 254 [ ]):
*** buffer overflow detected ***: terminated
Abandon (core dumped)
(gdb) bt
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
#1 __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2 __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3 0x00007ffff7c4526e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4 0x00007ffff7c288ff in __GI_abort () at ./stdlib/abort.c:79
#5 0x00007ffff7c297b6 in __libc_message_impl (fmt=fmt@entry=0x7ffff7dce765 "*** %s ***: terminated\n")
at ../sysdeps/posix/libc_fatal.c:132
#6 0x00007ffff7d36c09 in __GI___fortify_fail (msg=msg@entry=0x7ffff7dce74c "buffer overflow detected")
at ./debug/fortify_fail.c:24
#7 0x00007ffff7d365c4 in __GI___chk_fail () at ./debug/chk_fail.c:28
#8 0x00007ffff7d37da5 in ___snprintf_chk (s=<optimized out>, maxlen=<optimized out>, flag=<optimized out>,
slen=<optimized out>, format=<optimized out>) at ./debug/snprintf_chk.c:29
#9 0x0000555555556335 in PrintExtBlock ()
#10 0x00005555555555f0 in main ()
(gdb)
I ran into this as well, building with -D_FORTIFY_SOURCE=3 - it's because the snprintf calls in giftext.c that write into AsciiForm have the length set as 3 rather than 2. Here's a patch.
Patch merged and pushed, thanks.