GNU bug report logs - #15472
segmentation fault if input line is too long

Previous Next

Package: grep;

Reported by: Holger Then <Holger.Then <at> bristol.ac.uk>

Date: Fri, 27 Sep 2013 06:28:12 UTC

Severity: normal

Tags: notabug

Done: Jim Meyering <meyering <at> fb.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jim Meyering <jim <at> meyering.net>
To: Holger Then <Holger.Then <at> bristol.ac.uk>
Cc: 15472 <at> debbugs.gnu.org
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 <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.