Opened 14 years ago

Closed 14 years ago

Last modified 14 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: Component: Standard UDFs
Version: Severity: None
Keywords: Cc:


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 Changed 14 years ago by Valik

  • Milestone set to
  • Owner changed from Gary to Valik
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [5440] in version:

comment:2 Changed 14 years ago by gtyler

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.

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

as closed The owner will remain Valik.

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

Note: See TracTickets for help on using tickets.