Bug 628213

Summary: tac has a double-free bug (input line longer than 16KiB)
Product: [Fedora] Fedora Reporter: Jim Meyering <meyering>
Component: coreutilsAssignee: Ondrej Vasik <ovasik>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 13CC: aquini, kdudka, ovasik, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: coreutils-8.4-9.fc13 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-10-19 07:13:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jim Meyering 2010-08-28 16:42:26 UTC
Description of problem:
tac aborts due to a double free -- but only when an input line is longer than 16KiB

Steps to Reproduce:
1.valgrind tac <(printf %0$((2**14 + 1))d 0) > /dev/null
2.
3.
  
Actual results:
     Invalid free() / delete / delete[]
        at 0x4A04D72: free (vg_replace_malloc.c:325)
        by 0x402294: main (tac.c:669)
      Address 0x4c30040 is 0 bytes inside a block of size 16,388 free'd
        at 0x4A05255: realloc (vg_replace_malloc.c:476)
        by 0x4117B8: xrealloc (xmalloc.c:57)
        by 0x401A68: tac_seekable (tac.c:319)
        by 0x402379: main (tac.c:515)


Without valgrind, I get a backtrace, then this:

   zsh: abort (core dumped)  tac <(printf %0$((2**14 + 1))d 0) > /dev/null


Expected results:
  no double free/abort

Additional info:
  patch posted at http://bugs.debian.org/594666#10

Comment 1 Ondrej Vasik 2010-08-28 22:11:57 UTC
Thanks for heads-up, Jim.

Comment 2 Ondrej Vasik 2010-08-31 12:01:30 UTC
Built in rawhide as coreutils-8.5-5.fc15.

Comment 3 Fedora Update System 2010-10-01 11:53:17 UTC
coreutils-8.4-9.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/coreutils-8.4-9.fc13

Comment 4 Fedora Update System 2010-10-05 09:37:30 UTC
coreutils-8.4-9.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update coreutils'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/coreutils-8.4-9.fc13

Comment 5 Fedora Update System 2010-10-19 07:13:01 UTC
coreutils-8.4-9.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.