From 59ee33e14ec6e7e914bc7a473685db4827d09fd6 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 21 May 2025 16:32:23 +0200 Subject: [PATCH] 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 --- mysys/my_timezone.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysys/my_timezone.cc b/mysys/my_timezone.cc index d155f014e93..a0cf106a796 100644 --- a/mysys/my_timezone.cc +++ b/mysys/my_timezone.cc @@ -159,7 +159,7 @@ extern "C" void my_tzname(char* sys_timezone, size_t size) { /* TZ environment variable not set - return default timezone name*/ UChar default_tzname[MAX_TIMEZONE_LEN]; - UErrorCode ec; + UErrorCode ec= U_ZERO_ERROR; int32_t len= ucal_getDefaultTimeZone(default_tzname, MAX_TIMEZONE_LEN, &ec); if (U_SUCCESS(ec))