Modify

Opened 13 years ago

Closed 13 years ago

#2274 closed Bug (No Bug)

StringRegExp crashes on large string

Reported by: MrCreatoR <mscreator@…> Owned by:
Milestone: Component: AutoIt
Version: 3.3.8.1 Severity: None
Keywords: Cc:

Description

Strange crash on large string with specific pattern, here is an example that shows this:

$vTest = '"'

For $i = 1 To 5935 ;Change to 5930 and no crash
	$vTest &= '0'
Next

$vTest &= '"'

$aRet = StringRegExp($vTest, '([^"])*', 3) ;Or change the pattern to '([^"]*)'
ConsoleWrite("Result: " & $aRet[0] & @LF)

The same with StringRegExpReplace.

Environment(Language:0419 Keyboard:00000409 OS:WIN_7/ CPU:X64 OS:X86)

Attachments (0)

Change History (3)

comment:1 by jchd, 13 years ago

I bet that this crash has nothing to do with AutoIt. It's the PCRE library going out of its own internal steam. You get the same kind of crash when using the pcretest.exe utility available from the PCRE website. Windows further limits the stack size of every executable.

Note that this combination of pattern and option is meaningless. Even without the 3 option, this useless pathological pattern is highly backtracking and best avoided in real-world applications.

comment:2 by jchd18, 13 years ago

Use either patterns to avoid high backtracking:

    $aRet = StringRegExp($vTest, '([^"]*)', 3)
    $aRet = StringRegExp($vTest, '([^"])*+', 3)

Both work fast with beta 3.3.9.8 on W7 X64/x86.

comment:3 by jchd18, 13 years ago

Resolution: No Bug
Status: newclosed

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.