Modify

Opened 13 years ago

Closed 12 years ago

#2148 closed Bug (Fixed)

Crash with _GUICtrlListBox_InsertString()

Reported by: Valik Owned by: guinness
Milestone: 3.3.9.5 Component: Standard UDFs
Version: 3.3.8.1 Severity: None
Keywords: Cc:

Description

The following code crashes Autoit (taken from #2147):

#include <GUIListBox.au3>

GUICreate("Test", 200, 320)
Local $list=GUICtrlCreateList("", 5, 2, 190, 280)
Local $button=GUICtrlCreateButton("Do It!", 40, 290, 120, 25)
GUISetState()

Global $msg
While 1
	$msg = GUIGetMsg()
	If $msg = -3 Then
		Exit
	ElseIf $msg = $button Then
		_GUICtrlListBox_InsertString($list, 1)	; Crash
	EndIf
WEnd

Changing the marked line to _GUICtrlListBox_InsertString($list, String(1)) fixes the crash.

Attachments (0)

Change History (4)

comment:1 Changed 13 years ago by BrewManNH <bobmarotte@…>

I noticed that if you use the code below it works without crashing too.

_GUICtrlListBox_InsertString(GUICtrlGetHandle($list), 1)

comment:2 Changed 13 years ago by Valik

Right. The crash is actually with GUICtrlSendMsg(). I imagine it looks at the type of the variant to determine what to pass to SendMessage(). Since in this example it is passing a number it gives SendMessage() a number but then the message handler tries to treat that number as a pointer to a string and boom, AutoIt crashes. I'm not sure that we can prevent the crash with GUICtrlSendMsg(). I think the best we can get here is a forced String() cast and a review of all code that uses GUICtrlSendMsg() to ensure it properly casts input to the correct type to prevent other crashes.

comment:3 Changed 13 years ago by trancexx

  • Component changed from AutoIt to Standard UDFs

comment:4 Changed 12 years ago by guinness

  • Milestone set to 3.3.9.5
  • Owner set to guinness
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [7223] in version: 3.3.9.5

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 owner will remain guinness.
Author


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

 
Note: See TracTickets for help on using tickets.