Skip to content

Commit 59ee33e

Browse files
committed
MDEV-32189 follow-up: Properly initialize UErrorCode for ucal_getDefaultTimeZone()
Initialize UErrorCode to U_ZERO_ERROR before passing it to ucal_getDefaultTimeZone(), as required by the ICU conventions. Passing an uninitialized status variable leads to undefined behavior and non-deterministic failures. This issue was not observed on x64 builds, but appeared during Windows/ARM64 CI testing. The lack of initialization led to inconsistent fallback between ICU and native Windows time zone. mtr tests with restarts showed the alternation of system_time_zone, as reported by check_testcase after the test. -SYSTEM_TIME_ZONE Coordinated Universal Time +SYSTEM_TIME_ZONE Etc/UTC
1 parent 9e1c1d4 commit 59ee33e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mysys/my_timezone.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ extern "C" void my_tzname(char* sys_timezone, size_t size)
159159
{
160160
/* TZ environment variable not set - return default timezone name*/
161161
UChar default_tzname[MAX_TIMEZONE_LEN];
162-
UErrorCode ec;
162+
UErrorCode ec= U_ZERO_ERROR;
163163
int32_t len=
164164
ucal_getDefaultTimeZone(default_tzname, MAX_TIMEZONE_LEN, &ec);
165165
if (U_SUCCESS(ec))

0 commit comments

Comments
 (0)