Modify

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#1325 closed Bug (Fixed)

Date.au3: calls to _Date_Time_SetLocalTime($pSystemTime) are not checking @error

Reported by: gtyler Owned by: Valik
Milestone: 3.3.1.7 Component: Standard UDFs
Version: 3.3.1.6 Severity: None
Keywords: Cc:

Description

In Date.au3, there are several function that call _Date_Time_SetLocalTime() and do not check for @error.
They expect the function to always return an array and then try to reference index 0 which generates an exception.

Here is the last two lines of _SetDate()

Local $iRetval = _Date_Time_SetLocalTime($lpSystemTime)
Return SetError(@error, @extended, Int($iRetval[0]))

Attachments (0)

Change History (2)

comment:1 by Valik, 16 years ago

Milestone: 3.3.1.7
Owner: changed from Gary to Valik
Resolution: Fixed
Status: newclosed

Fixed by revision [5440] in version: 3.3.1.7

comment:2 by gtyler, 16 years ago

There are still two pieces of code in Date.au3 that concern me:

Local $aResult = DllCall("kernel32.dll", "dword", "GetTimeZoneInformation", "ptr", DllStructGetPtr($tTimeZone))
If @error Or $aResult[0] = -1 Then Return SetError(@error, @extended, 0)

Local $aResult = DllCall("kernel32.dll", "bool", "SetLocalTime", "ptr", $pSystemTime)
If @error Or Not $aResult Then Return SetError(@error, @extended, False)

If @error is 0 but the second condition is met for each of those OR statements, then 0 will be returned in @error and the calling function may still try to access the array since it will only check for @error.
I think it should explicity set @error or all the calling programs need to use isArray() to make sure an array has been returned.

Modify Ticket

Action
as closed The owner will remain Valik.

Add Comment


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