Modify

#2070 closed Bug (Fixed)

_GUICtrlStatusBar_GetText() Crash

Reported by: TsukasaX Owned by: guinness
Milestone: 3.3.9.1 Component: Standard UDFs
Version: 3.3.7.21 Severity: None
Keywords: Cc:

Description

Func _Port()
	Local $iPort = 0
	Local $sPort = _SendQuiet('port')
	If $iPort = 0 Then $iPort = _Regex($sPort, 'Port: ([\d]+)', 0)

	Local $sIP = _GUICtrlStatusBar_GetText($hStatus, 0)
	If StringRegExp($sIP, '(\:[\d]+)') = 1 Then
		$sIP = StringRegExpReplace($sIP, '\:[\d]+', $iPort)
	Else
		$sIP &= ':' & $iPort
	EndIf
	_GUICtrlStatusBar_SetText($hStatus, $sIP, 0)

The idea of this code is to get the first part of a 4-part status bar that already has an IP address in it, determine if a port number is in it, and either update it or add it on then update the status bar.

Putting FileWriteLine()'s between commands shows the crash is indeed _GUICtrlStatusBar_GetText() as the FileWriteLine() one line after isn't reached. I tested some other _GUICtrlStatusBar functions and they worked one line before _GUICtrlStatusBar_GetText().

The crash is an ntdll.dll APPCRASH exception code c0000005.

I am unable to check to see if this issue has already been resolved because of no proper changelog.

Attachments (0)

Change History (12)

in reply to:  description comment:1 by TsukasaX, on Dec 21, 2011 at 6:20:11 AM

Some of the functions may need some more explanation. _SendQuiet('port') should retrieve a string like "Port: 7000", and _Regex() would then retrieve the number with the "0" parameter being the default return value.

comment:2 by Jpm, on Dec 21, 2011 at 8:12:38 AM

When you submit a test example, please make it "working".
Your one has no EndFunc neither an simulation of _SendQuiet(), _RegEx().
The worst is we cannot reproduce anything as we don't know on what $hStatus is coming from

Don't forget also to describe the environment you are running under as

Environment(Language:040C Keyboard:0000040C OS:WIN_7/Service Pack 1 CPU:X64 OS:X86)

We don't have cristal ball ...

in reply to:  2 comment:3 by TsukasaX, on Dec 28, 2011 at 7:20:03 AM

Replying to Jpm:

When you submit a test example, please make it "working".
Your one has no EndFunc neither an simulation of _SendQuiet(), _RegEx().
The worst is we cannot reproduce anything as we don't know on what $hStatus is coming from

Don't forget also to describe the environment you are running under as

Environment(Language:040C Keyboard:0000040C OS:WIN_7/Service Pack 1 CPU:X64 OS:X86)

We don't have cristal ball ...

Also crashes at same line on 3.3.6.1 it seems.

The EndFunc was supposed to be the line after, sorry about that.
Environment(Language:0409 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64)

Here is the full source (without includes): <removed>, the line of interest is #252.

Last edited on Dec 28, 2011 at 7:17:35 PM by Valik (previous) (diff)

comment:4 by TsukasaX, on Dec 28, 2011 at 7:23:05 AM

Same line also crashes with 3.3.8.0

comment:5 by Jpm, on Dec 28, 2011 at 9:05:48 AM

Thanks but your script cannot repro the pb.
Can you try to isolate the error as the "stream" stuff cannot run on any dev machine.
It is important to have the smallest repro script using basic window resource if possible.
Most of the time it is possible on real bug.

comment:6 by TsukasaX, on Dec 28, 2011 at 5:08:36 PM

http://pastebin.com/nL4vyEps this code produced the same problem for me with _GUICtrlStatusBar_GetText() and has far less dependencies.

comment:7 by wraithdu, on Dec 28, 2011 at 5:30:32 PM

The problem is the text buffer is created too small. It needs to have room for a terminating null character, so in 3 different functions in that UDF it should read

	If $fUnicode Then
		$tText = DllStructCreate("wchar Text[" & $iBuffer + 1 & "]")
		$iBuffer *= 2
	Else
		$tText = DllStructCreate("char Text[" & $iBuffer + 1 & "]")
	EndIf

in reply to:  6 ; comment:8 by Jpm, on Dec 28, 2011 at 8:12:28 PM

Replying to TsukasaX:

http://pastebin.com/nL4vyEps this code produced the same problem for me with _GUICtrlStatusBar_GetText() and has far less dependencies.

wraithdu is certainly true but on my system the crash does not occur ...

in reply to:  8 ; comment:9 by TsukasaX, on Dec 28, 2011 at 8:38:19 PM

Replying to Jpm:

Replying to TsukasaX:

http://pastebin.com/nL4vyEps this code produced the same problem for me with _GUICtrlStatusBar_GetText() and has far less dependencies.

wraithdu is certainly true but on my system the crash does not occur ...

After manually changing the UDF to what wraithdu said, I did not get the crash even after multiple tests.

in reply to:  9 comment:10 by Jpm, on Dec 28, 2011 at 10:48:26 PM

Replying to TsukasaX:

Replying to Jpm:

Replying to TsukasaX:

http://pastebin.com/nL4vyEps this code produced the same problem for me with _GUICtrlStatusBar_GetText() and has far less dependencies.

wraithdu is certainly true but on my system the crash does not occur ...

After manually changing the UDF to what wraithdu said, I did not get the crash even after multiple tests.

very good I hope somebody will commit it

comment:11 by guinness, on Feb 7, 2012 at 9:22:29 PM

Milestone: 3.3.9.1
Owner: set to guinness
Resolution: Fixed
Status: newclosed

Fixed by revision [6787] in version: 3.3.9.1

comment:12 by Jpm, on Feb 9, 2012 at 2:53:06 PM

Component: AutoItStandard UDFs

Modify Ticket

Action
as closed The owner will remain guinness.

Add Comment


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