Modify

Opened 13 years ago

Closed 13 years ago

#1810 closed Bug (Wont Fix)

Crash, StringRegExpReplace, recursion.

Reported by: mvg Owned by:
Milestone: Component: AutoIt
Version: 3.3.6.1 Severity: None
Keywords: crash StringRegExpReplace recurstion Cc:

Description

Crash, StringRegExpReplace, recursion.

crashes when a recursion patter is given more than N characters to store(?).

  • note: Not sure, but the number N might differ in differant situations. (final script, OS, ...)
  • not really tested with StringRegExp, other than a quick

v3.3.6.1 on Win.Xp.Pro.32.Sp3

;; Crash, StringRegExpReplace, recursion.
;; crashes when a recursion patter is given more than N characters to store(?).
;; - note: Not sure, but the number N might differ in differant situations. (final script, OS, ...)
;; - not really tested with StringRegExp, other than a quick StringRegExp test with same pattern and data. witch did not fail ...

bug()
Func bug()
	Local $iFill = 0, $aText1, $aText2, $sPattern, $result

	$sPattern = '(?x)  X  (?:  (?>  [^XZ]  )  |  (?R)  )*  Z' ;; pat A
	$iFill = 5931 ;; pat A

;~ 	$sPattern = '(?x)  X  (?:  (?>  [^XZ]  )  |  (?R)  )+ Z' ;; pat B
;~ 	$iFill = 5932 ;; pat B

	$aText1 = 'aXX' & StringRepeat($iFill, 'o') & 'ZZb'
	$aText2 = 'aXX' & StringRepeat($iFill + 1, 'o') & 'ZZb'

	$result = StringRegExpReplace($aText1, $sPattern, '[$0]')
	ConsoleWrite('1) ' & CompressFiller($result) & ', err: ' & @error & ', ext: ' & @extended & @CRLF)
	$result = StringRegExpReplace($aText2, $sPattern, '[$0]')
	ConsoleWrite('2) ' & CompressFiller($result) & ', err: ' & @error & ', ext: ' & @extended & @CRLF)
EndFunc

;; support functions.
Func StringRepeat($iRep, $sRep = ' ')
	Local $sOut = ''
	For $i = 1 To $iRep
		$sOut &= $sRep
	Next
	Return $sOut
EndFunc
Func CompressFiller(ByRef $sText, $sChar = 'o', $err = @error, $ext = @extended)
	If Not IsString($sChar) Or _
			StringLen($sChar) > 1 Or _
			StringUpper($sChar) == StringLower($sChar) _
			Then Exit 961 ;; Return SetError(1, 0, 0)
	$sChar = StringLower($sChar)
	Local $ipos2, $iPos1 = StringInStr($sText, 'o', 1) ;; find first.
	While $iPos1 ;; any left.
		$ipos2 = $iPos1 + 1
		While StringMid($sText, $ipos2, 1) == $sChar ;; count repeats.
			$ipos2 += 1
		WEnd
		$sText = StringMid($sText, 1, $iPos1 - 1) & '(' & StringUpper($sChar) & ':' & String($ipos2 - $iPos1) & ')' & StringMid($sText, $ipos2, -1) ;; adjust string.
		$iPos1 = StringInStr($sText, 'o', 1) ;; find next, if any.
	WEnd
	$sText = StringReplace($sText, '(' & StringUpper($sChar) & ':', '(' & $sChar & ':') ;; finalize.
	Return SetError($err, $ext, $sText)
EndFunc

Attachments (0)

Change History (3)

comment:1 Changed 13 years ago by mvg

With "Crash" I mean a unexpected script termination:

1) a[XX(o:5931)ZZ]b, err: 0, ext: 1
!>19:14:54 AutoIT3.exe ended.rc:-1073741819
>Exit code: -1073741819    Time: 2.216

comment:2 in reply to: ↑ description Changed 13 years ago by mvg

Correction on the "witch did not fail" in:

not really tested with StringRegExp, other than a quick StringRegExp test with same pattern and data. witch did not fail ...

StringRegExp() will also fail. At the same(size) point.
(not sure why this one got by me, but it did. :P )

	$result = StringRegExp($aText1, $sPattern, 3)
	ConsoleWrite('1[0]) ' & CompressFiller($result[0]) & ', err: ' & @error & ', ext: ' & @extended & @CRLF)
	$result = StringRegExp($aText2, $sPattern, 3)
	ConsoleWrite('2[0]) ' & CompressFiller($result[0]) & ', err: ' & @error & ', ext: ' & @extended & @CRLF)

comment:3 Changed 13 years ago by Jon

  • Resolution set to Wont Fix
  • 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.