GNU bug report logs - #19567
"segmentation fault" for long patterns ...

Previous Next

Package: grep;

Reported by: Roméo Capulet <p-pioneer-q <at> gmx.fr>

Date: Sun, 11 Jan 2015 16:30:02 UTC

Severity: normal

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 19567 in the body.
You can then email your comments to 19567 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#19567; Package grep. (Sun, 11 Jan 2015 16:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Roméo Capulet <p-pioneer-q <at> gmx.fr>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Sun, 11 Jan 2015 16:30:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Roméo Capulet <p-pioneer-q <at> gmx.fr>
To: bug-grep <at> gnu.org
Subject: "segmentation fault" for long patterns ...
Date: Sun, 11 Jan 2015 17:28:37 +0100
[Message part 1 (text/plain, inline)]
hi

I got a segmentation fault when I try to match a very long pattern on a 
file:
$ grep -Po 'jQuery\.extend\(Drupal\.settings,[ 
\t]*\{((?!\}\}\)).)+\}\}\);' /tmp/pattern-exemple.txt
Erreur de segmentation


the grep version : grep (GNU grep) 2.16


the gdb backtrace:
#0  0xb7f7d01a in ?? () from /lib/i386-linux-gnu/libpcre.so.3
#1  0xb7f8b090 in ?? () from /lib/i386-linux-gnu/libpcre.so.3
#2  0xb7f8b3e3 in ?? () from /lib/i386-linux-gnu/libpcre.so.3
#3  0xb7f8b090 in ?? () from /lib/i386-linux-gnu/libpcre.so.3
#4  0xb7f8b3e3 in ?? () from /lib/i386-linux-gnu/libpcre.so.3
(...)
#13099 0xb7f8b090 in ?? () from /lib/i386-linux-gnu/libpcre.so.3
#13100 0xb7f88ab3 in ?? () from /lib/i386-linux-gnu/libpcre.so.3
#13101 0xb7f8e9f3 in pcre_exec () from /lib/i386-linux-gnu/libpcre.so.3
#13102 0x0804c8a2 in ?? ()
#13103 0x0804e191 in ?? ()
#13104 0x0804f3de in ?? ()
#13105 0x0804a630 in ?? ()
#13106 0xb7dc7905 in __libc_start_main (main=0x804a150, argc=4, 
ubp_av=0xbffff8a4, init=0x806bfd0, fini=0x806c040, rtld_fini=0xb7fed5f0 
<_dl_fini>, stack_end=0xbffff89c) at libc-start.c:260
#13107 0x0804b16d in ?? ()

[pattern-exemple.txt (text/plain, attachment)]

Reply sent to Jim Meyering <jim <at> meyering.net>:
You have taken responsibility. (Sun, 11 Jan 2015 17:26:02 GMT) Full text and rfc822 format available.

Notification sent to Roméo Capulet <p-pioneer-q <at> gmx.fr>:
bug acknowledged by developer. (Sun, 11 Jan 2015 17:26:03 GMT) Full text and rfc822 format available.

Message #10 received at 19567-done <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Roméo Capulet <p-pioneer-q <at> gmx.fr>
Cc: 19567-done <at> debbugs.gnu.org
Subject: Re: bug#19567: "segmentation fault" for long patterns ...
Date: Sun, 11 Jan 2015 09:25:00 -0800
On Sun, Jan 11, 2015 at 8:28 AM, Roméo Capulet <p-pioneer-q <at> gmx.fr> wrote:
> I got a segmentation fault when I try to match a very long pattern on a
> file:
> $ grep -Po 'jQuery\.extend\(Drupal\.settings,[ \t]*\{((?!\}\}\)).)+\}\}\);'
> /tmp/pattern-exemple.txt
> Erreur de segmentation
>
> the grep version : grep (GNU grep) 2.16

Thank you for the complete bug report.
That appears to be due to a bug in the version of libpcre that your
version of grep uses.
Using the latest release, grep-2.21 with newer pcre, that example no
longer causes trouble.

Since this issue appears not to affect the latest version, I'm marking
this ticket as "done".




Information forwarded to bug-grep <at> gnu.org:
bug#19567; Package grep. (Mon, 12 Jan 2015 00:55:02 GMT) Full text and rfc822 format available.

Message #13 received at 19567 <at> debbugs.gnu.org (full text, mbox):

From: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
To: Romeo Capulet <p-pioneer-q <at> gmx.fr>
Cc: 19567 <at> debbugs.gnu.org
Subject: Re: bug#19567: "segmentation fault" for long patterns ...
Date: Mon, 12 Jan 2015 09:53:59 +0900
On Sun, 11 Jan 2015 17:28:37 +0100
Romeo Capulet <p-pioneer-q <at> gmx.fr> wrote:

> hi
> 
> I got a segmentation fault when I try to match a very long pattern on a file:
> $ grep -Po 'jQuery\.extend\(Drupal\.settings,[ \t]*\{((?!\}\}\)).)+\}\}\);' /tmp/pattern-exemple.txt
> Erreur de segmentation
> 
> 
> the grep version : grep (GNU grep) 2.16
> 
> 
> the gdb backtrace:
> #0  0xb7f7d01a in ?? () from /lib/i386-linux-gnu/libpcre.so.3
> #1  0xb7f8b090 in ?? () from /lib/i386-linux-gnu/libpcre.so.3
> #2  0xb7f8b3e3 in ?? () from /lib/i386-linux-gnu/libpcre.so.3
> #3  0xb7f8b090 in ?? () from /lib/i386-linux-gnu/libpcre.so.3
> #4  0xb7f8b3e3 in ?? () from /lib/i386-linux-gnu/libpcre.so.3
> (...)
> #13099 0xb7f8b090 in ?? () from /lib/i386-linux-gnu/libpcre.so.3
> #13100 0xb7f88ab3 in ?? () from /lib/i386-linux-gnu/libpcre.so.3
> #13101 0xb7f8e9f3 in pcre_exec () from /lib/i386-linux-gnu/libpcre.so.3
> #13102 0x0804c8a2 in ?? ()
> #13103 0x0804e191 in ?? ()
> #13104 0x0804f3de in ?? ()
> #13105 0x0804a630 in ?? ()
> #13106 0xb7dc7905 in __libc_start_main (main=0x804a150, argc=4,
> ubp_av=0xbffff8a4, init=0x806bfd0, fini=0x806c040,
> rtld_fini=0xb7fed5f0 <_dl_fini>, stack_end=0xbffff89c) at libc-start.c:260
> #13107 0x0804b16d in ?? ()
> 

Perhaps, this bug may be duplication of bug#19420.  If we search a
pattern with "?!" for a long line, we can cause stack overflow.

Can you avoid the bug by increasing of stack size?





Information forwarded to bug-grep <at> gnu.org:
bug#19567; Package grep. (Mon, 12 Jan 2015 06:33:02 GMT) Full text and rfc822 format available.

Message #16 received at 19567 <at> debbugs.gnu.org (full text, mbox):

From: Roméo Capulet <p-pioneer-q <at> gmx.fr>
To: 19567 <at> debbugs.gnu.org
Subject: Re: bug#19567: closed (Re: bug#19567: "segmentation fault" for long
 patterns ...)
Date: Mon, 12 Jan 2015 07:32:09 +0100
Le 11/01/2015 18:26, GNU bug Tracking System a écrit :
> Your bug report
>
> #19567: "segmentation fault" for long patterns ...
>
> which was filed against the grep package, has been closed.
>
> The explanation is attached below, along with your original report.
> If you require more details, please reply to 19567 <at> debbugs.gnu.org.
>
Ok so i've downloaded, compiled and installed grep-2.21 and pcre2-10.00 
and the bug does not occur any more so seem to be fixed.

thanks.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 09 Feb 2015 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 132 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.