[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/14352] New: grep -P dumps when using large regex, version
From: |
robert.klima at gmail dot com |
Subject: |
[Bug binutils/14352] New: grep -P dumps when using large regex, version 2.5.1 |
Date: |
Wed, 11 Jul 2012 15:04:44 +0000 |
http://sourceware.org/bugzilla/show_bug.cgi?id=14352
Bug #: 14352
Summary: grep -P dumps when using large regex, version 2.5.1
Product: binutils
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: binutils
AssignedTo: address@hidden
ReportedBy: address@hidden
Classification: Unclassified
This causes grep to dump:
address@hidden:~> ( echo 'if ( GetProfileStr( "GLOBAL", "HW", ins, iVar->hw,
sizeof( iVar->hw ) - 1,'; echo ' pcx->iniFile )) x=2; /* return
value not used */' ) | grep -P
'(?s)if\s*[(][^()]*([^()]*[(][^()]*([^()]*[(][^()]*([^()]*[(][^()]*([^()]*[(][^()]*([^()]*[(][^()]*([^()]*[(][^()](?#innerpart)*[^()]*[)][^()]*)*[^()]*[)][^()]*)*[^()]*[)][^()]*)*[^()]*[)][^()]*)*[^()]*[)][^()]*)*[^()]*[)][^()]*)*[^()]*[)]\s*((?#a_comment)\s*[/][*]([^*]|[*][^/])*[*][/]\s*)*;'
Aborted (core dumped)
remove these three chars "x=2" and it works:
address@hidden:~> ( echo 'if ( GetProfileStr( "GLOBAL", "HW", ins, iVar->hw,
sizeof( iVar->hw ) - 1,'; echo ' pcx->iniFile )) ; /* return
value not used */' ) | grep -P
'(?s)if\s*[(][^()]*([^()]*[(][^()]*([^()]*[(][^()]*([^()]*[(][^()]*([^()]*[(][^()]*([^()]*[(][^()]*([^()]*[(][^()](?#innerpart)*[^()]*[)][^()]*)*[^()]*[)][^()]*)*[^()]*[)][^()]*)*[^()]*[)][^()]*)*[^()]*[)][^()]*)*[^()]*[)][^()]*)*[^()]*[)]\s*((?#a_comment)\s*[/][*]([^*]|[*][^/])*[*][/]\s*)*;'
if ( GetProfileStr( "GLOBAL", "HW", ins, iVar->hw, sizeof( iVar->hw ) - 1,
pcx->iniFile )) ; /* return value not used */
address@hidden:~> grep --version
grep (GNU grep) 2.5.1
Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Explanation of the regex:
The regex is a straight forward aproach to check for balanced parantheses in
C-code and then to check whether there is an if-statement or not (empty
if-statement).
It is necessary to code such a complex regex like this as regex normally cannot
be used to deal with balanced parantheses.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
- [Bug binutils/14352] New: grep -P dumps when using large regex, version 2.5.1,
robert.klima at gmail dot com <=