Bug 869442 - uniq -c crashes while "uniq -c" from GNU Coreutils OK.
Summary: uniq -c crashes while "uniq -c" from GNU Coreutils OK.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: rawhide
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Ondrej Vasik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-23 22:21 UTC by Shlomi Fish
Modified: 2013-03-12 08:51 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-01-23 09:08:07 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Input Causing uniq -c to crash after compressed with xz. (354.56 KB, application/octet-stream)
2012-10-23 22:21 UTC, Shlomi Fish
no flags Details

Description Shlomi Fish 2012-10-23 22:21:59 UTC
Created attachment 632427 [details]
Input Causing uniq -c to crash after compressed with xz.

Description of problem:

With the attachment, doing:

unxz < uniq-c.crash.txt.xz | uniq -c

generates an indication of a Segmentation fault on both Mageia 2 x86-64 and
Mageia Cauldron x86-64. This does not happen with unxz < uniq-c.crash.txt.xz |
~/apps/temp-coreutils/bin/uniq -c (where this uniq was installed using
"./configure --prefix="$HOME/apps/temp-coreutils" ; "make" ; "make install"
from the GNU coreutils sources).

The file contains a long line of items separated by CRs, due to a
mis-generation (which was since fixed) but uniq still should not crash.

How reproducible:

Always

Steps to Reproduce:
1. unxz < uniq-c.crash.txt.xz | uniq -c
  
Actual results:

Segfault.

Expected results:

Correct output returned.

Additional info:

See https://bugs.mageia.org/show_bug.cgi?id=7592

After some amount of investigation (thanks to Luigi12_work from IRC for
some insights), we found out that the problem was with
coreutils-8.19-new-i18n.patch patch. If we remove it, do "bm -l -p" and run
"./configure --prefix ; make ; make install", then the unxz < ... |
~/apps/temp-coreutils-rpm/uniq -c works fine. With all patches applied it
segfaults.

This patch is identical to this Fedora patch:

http://pkgs.fedoraproject.org/cgit/coreutils.git/plain/coreutils-i18n.patch

Comment 1 Ondrej Vasik 2012-10-24 07:33:09 UTC
Thanks for report, confirmed. You can just use 'LC_ALL=C uniq -c' to disable the multibyte path for this case.

Comment 2 yu.valery+bugzilla 2013-01-22 14:28:46 UTC
It also affects sort and join
http://permalink.gmane.org/gmane.comp.security.oss.general/9215

Comment 3 Ondrej Vasik 2013-01-22 20:20:20 UTC
SUSE fix is to use xmalloc and free instead of alloca ... makes sense - https://build.opensuse.org/package/rdiff?linkrev=base&package=coreutils&project=Base%3ASystem&rev=173 is the link to the commit. I'll make an update tomorrow.

Comment 4 Ondrej Vasik 2013-01-23 09:08:07 UTC
Fixed in Rawhide - coreutils-8.20-6.fc19 - http://lists.fedoraproject.org/pipermail/scm-commits/2013-January/933514.html . CLOSING RAWHIDE (will prepare updates for lower Fedoras based on #902917)

Comment 5 Fedora Update System 2013-01-30 16:18:45 UTC
coreutils-8.15-10.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/coreutils-8.15-10.fc17

Comment 6 Fedora Update System 2013-03-12 08:51:09 UTC
coreutils-8.15-10.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.