Modify

Opened 11 years ago

Closed 5 years ago

#2884 closed Bug (Wont Fix)

AutoIt tries to call COM VariantClear() on uninitialized memory

Reported by: coderpro@… Owned by:
Milestone: Component: AutoIt
Version: 3.3.13.19 Severity: None
Keywords: COM crash Cc:

Description

A COM OLE query to an MS SQL Server database results in a crash in AutoIt's wrapper that calls oleaut32.dll VariantClear(). The attached file recreates the bug.

Change History (3)

Changed 11 years ago by coderpro@…

Connect to an MS SQL Server to test COM

comment:1 Changed 10 years ago by mLipok

this is the same problem like here:
https://www.autoitscript.com/trac/autoit/ticket/2887

As you can see here:

Func _ExecStatements(Const $oConn, Const $sStatements, Const $bIgnoreInvalidObjRef = False)
    _WriteDiag("Info", "Executing: "&@CRLF&$sStatements)
    $COMstatusMessage = "attempting to execute query"

    If $bIgnoreInvalidObjRef Then
        $g_oErrObj = ObjEvent("AutoIt.Error", "_COMwarningHandlerWrapper")
    EndIf

    Local $oRecordSet = _SQLQuery($oConn, $sStatements)

    If $bIgnoreInvalidObjRef Then
        $g_oErrObj = ObjEvent("AutoIt.Error", "_COMerrorHandler")
    EndIf

    Return $oRecordSet
EndFunc

You are setting $g_oErrObj few times.
The workaround is to set:
$g_oErrObj = Null

Func _ExecStatements(Const $oConn, Const $sStatements, Const $bIgnoreInvalidObjRef = False)
    _WriteDiag("Info", "Executing: "&@CRLF&$sStatements)
    $COMstatusMessage = "attempting to execute query"

    If $bIgnoreInvalidObjRef Then
        $g_oErrObj = Null
		$g_oErrObj = ObjEvent("AutoIt.Error", "_COMwarningHandlerWrapper")
    EndIf

    Local $oRecordSet = _SQLQuery($oConn, $sStatements)

    If $bIgnoreInvalidObjRef Then
        $g_oErrObj = Null
        $g_oErrObj = ObjEvent("AutoIt.Error", "_COMerrorHandler")
    EndIf

    Return $oRecordSet
EndFunc

comment:2 Changed 5 years ago by Jpm

  • Resolution set to Wont Fix
  • Status changed from new to closed

no update so I close it

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

Author


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

 
Note: See TracTickets for help on using tickets.