Attached debdiff for fim 0.7.1-5ubuntu1 targeting Ubuntu stonking.

Upstream PR: https://download.savannah.nongnu.org/releases/fbi-
improved/fim-0.8.0.tar.gz

Verified on clean test stand: reproduced prior to fix, confirmed working
with debdiff, 0 regressions in test suite.


** Description changed:

+ Problem:
+ fim 0.7.1-5 FTBFS in Ubuntu 26.10 (stonking) under -D_FORTIFY_SOURCE=3 
because slurp_binary_fd() shrinks buffer to rb+1 bytes, triggering glibc buffer 
overflow abort on subsequent read.
+ 
+ Root Cause & Fix:
+ Backport upstream fim 0.8.0 fix in src/common.cpp: allocate (rb+=nrb)+inc+1 
bytes in fim_realloc to accommodate next read chunk and ensure NUL termination.
+ 
+ Verification:
+ 1. Reproduce on unmodified 0.7.1-5: echo 'quit 33' | ./src/fim --no-rc-file 
--no-etc-fimrc-file --no-history -o dumb --script-from-stdin (aborts with '*** 
buffer overflow detected ***').
+ 2. Verify with fix: all 6 --script-from-stdin tests pass with expected return 
codes 33 and 22, and full dpkg-buildpackage test suite passes with 0 failures.
+ 
+ Upstream: https://download.savannah.nongnu.org/releases/fbi-
+ improved/fim-0.8.0.tar.gz
+ 
+ 
+ --- [ Original Report ]
+ 
  fim 0.7.1-5 has been stuck in stonking-proposed for ~324 days:
  
    missing build on amd64/amd64v3/arm64/armhf/ppc64el/s390x: fim (from
  0.6~rc2-1build2)
  
  Build log (amd64):
  https://launchpad.net/ubuntu/+source/fim/0.7.1-5/+build/32793429
  
  The build itself succeeds; the upstream test suite run during the build
  aborts:
  
    echo 'quit 33' | ./src/fim --no-rc-file --no-etc-fimrc-file --no-history -o 
dumb --script-from-stdin ; test $? = 33
    *** buffer overflow detected ***: terminated
    ... Aborted (core dumped) | ./src/fim ... --script-from-stdin
    make[2]: *** [Makefile:1423: tests] Error 1
  
  Likely cause: Ubuntu builds with -D_FORTIFY_SOURCE=3 (Debian uses =2),
  and glibc's fortified checks catch an out-of-bounds write in fim when
  reading a script from stdin. This is probably a real bug in fim that
  Debian's flags don't detect; the same version builds fine in Debian
  (binaries on all release architectures, no open Debian bug about it).
  
  Upstream (https://www.nongnu.org/fbi-improved/) has a newer release,
  0.8.0.
  
  Suggested direction (to be done by whoever picks this up):
  - Reproduce locally (build in a stonking chroot/container and run the failing 
command above), then get a backtrace (gdb, or rebuild with -O0 -g / ASan) to 
find the overflowing buffer.
  - Check whether fim 0.8.0 already fixes it; if so, consider a backport of the 
fix (or the new version, depending on freeze rules).
  - Otherwise patch the overflow, upload as an Ubuntu delta and forward the fix 
to Debian and upstream.
  - Avoid just lowering to _FORTIFY_SOURCE=2 unless as a last resort: that 
would hide a real memory-safety bug.

** Changed in: fim (Ubuntu)
       Status: New => Confirmed

** Tags added: patch stonking

** Patch added: "fim_0.7.1-5ubuntu1_stonking.debdiff"
   
https://bugs.launchpad.net/ubuntu/+source/fim/+bug/2170358/+attachment/6008199/+files/fim_0.7.1-5ubuntu1_stonking.debdiff

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2170358

Title:
  fim 0.7.1-5 FTBFS in stonking: test aborts with '*** buffer overflow
  detected ***' (_FORTIFY_SOURCE=3)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/fim/+bug/2170358/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to