Modify

Opened 11 years ago

Closed 6 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.

Attachments (1)

comtest.zip (3.5 KB ) - added by coderpro@… 11 years ago.
Connect to an MS SQL Server to test COM

Download all attachments as: .zip

Change History (3)

by coderpro@…, 11 years ago

Attachment: comtest.zip added

Connect to an MS SQL Server to test COM

comment:1 by mLipok, 11 years ago

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 by J-Paul Mesnage, 6 years ago

Resolution: Wont Fix
Status: newclosed

no update so I close it

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


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