[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#15472: segmentation fault if input line is too long
From: |
Jim Meyering |
Subject: |
bug#15472: segmentation fault if input line is too long |
Date: |
Sat, 28 Sep 2013 21:14:10 -0700 |
On Thu, Sep 26, 2013 at 5:21 AM, Holger Then <address@hidden> wrote:
> If grep searches through a line that is longer than
> INT_MAX (= 2147483647) characters, then grep causes
...
> $ tail -c 2147483647 grep_bug.txt | grep -e 1 | wc
> 1 8385663 2147483647
> $ tail -c 2147483648 grep_bug.txt | grep -e 1 | wc
> 0 0 0
> $ tail -c 2147483648 grep_bug.txt | grep -e 1
> Segmentation fault
>
> $ uname -a
> Linux c-0-0.local 2.6.32-358.11.1.el6.x86_64 #1 SMP Wed Jun 12 03:34:52 UTC
> 2013 x86_64 x86_64 x86_64 GNU/Linux
> $ grep --version
> GNU grep 2.6.3
tags 15472 notabug
close 15472
thanks
Thank you for the report.
Your version of grep is rather old. The latest is grep-2.14,
and that particular bug was fixed in 2.11 a year and a half ago.
Here is the relevant NEWS entry:
* Noteworthy changes in release 2.11 (2012-03-02) [stable]
** Bug fixes
grep no longer dumps core on lines whose lengths do not fit in 'int'.
(e.g., lines longer than 2 GiB on a typical 64-bit host).
Instead, grep either works as expected, or reports an error.
An error can occur if not enough main memory is available, or if the
GNU C library's regular expression functions cannot handle such long lines.
[bug present since "the beginning"]