bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15472: segmentation fault if input line is too long


From: Holger Then
Subject: bug#15472: segmentation fault if input line is too long
Date: Thu, 26 Sep 2013 14:21:54 +0200 (CEST)
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)

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.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]