GNU bug report logs -
#15472
segmentation fault if input line is too long
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15472 in the body.
You can then email your comments to 15472 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-grep <at> gnu.org
:
bug#15472
; Package
grep
.
(Fri, 27 Sep 2013 06:28:12 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Holger Then <Holger.Then <at> bristol.ac.uk>
:
New bug report received and forwarded. Copy sent to
bug-grep <at> gnu.org
.
(Fri, 27 Sep 2013 06:28:13 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
If grep searches through a line that is longer than
INT_MAX (= 2147483647) characters, then grep causes
a segmentation fault.
Interestingly this bug does not occur with fgrep or
with grep -F
Kind regards,
Holger
$ wc grep_bug.txt
1 12200610 3281667946 grep_bug.txt
$ fgrep -e 1 grep_bug.txt | wc
1 12200610 3281667946
$ grep -Fe 1 grep_bug.txt | wc
1 12200610 3281667946
$ grep -e 1 grep_bug.txt | wc
0 0 0
$ grep -e 1 grep_bug.txt
Segmentation fault
$ 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
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Information forwarded
to
bug-grep <at> gnu.org
:
bug#15472
; Package
grep
.
(Sun, 29 Sep 2013 04:15:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 15472 <at> debbugs.gnu.org (full text, mbox):
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"]
Added tag(s) notabug.
Request was from
Jim Meyering <meyering <at> fb.com>
to
control <at> debbugs.gnu.org
.
(Mon, 14 Oct 2013 22:20:04 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
15472 <at> debbugs.gnu.org and Holger Then <Holger.Then <at> bristol.ac.uk>
Request was from
Jim Meyering <meyering <at> fb.com>
to
control <at> debbugs.gnu.org
.
(Mon, 14 Oct 2013 22:20:05 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 12 Nov 2013 12:24:03 GMT)
Full text and
rfc822 format available.
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.