GNU bug report logs -
#15472
segmentation fault if input line is too long
Previous Next
Full log
View this message in rfc822 format
On Thu, Sep 26, 2013 at 5:21 AM, Holger Then <Holger.Then <at> bristol.ac.uk> 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"]
This bug report was last modified 11 years and 219 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.