Modify

Opened 6 years ago

Closed 5 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 Changed 6 years ago by jchd

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 Changed 5 years ago by jchd18

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 Changed 5 years ago by jchd18

  • Resolution set to No Bug
  • Status changed from new to closed

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.