Skip to content
Snippets Groups Projects
Commit 4305d397 authored by Andrey Saranchin's avatar Andrey Saranchin Committed by Serge Petrenko
Browse files

icu: fix potential UB in DangiCalendar

Method `getDangiCalZoneAstroCalc` is used to calculate an argument for
base class constructor when it is not built yet. Fortunately, it does not
use class fields - let's make it static to use it before class
initialization legitimately.

Closes tarantool/security#96

NO_TEST=no behaviour changes
NO_CHANGELOG=no behaviour changes
NO_DOC=no behaviour changes
parent b5163ef7
No related branches found
No related tags found
No related merge requests found
......@@ -118,6 +118,7 @@ ExternalProject_Add(icu
PATCH_COMMAND patch -d <SOURCE_DIR> -p1 -i "${PATCHES_DIR}/icu-tarantool-security-45.patch"
COMMAND patch -d <SOURCE_DIR> -p1 -i "${PATCHES_DIR}/icu-tarantool-security-59.patch"
COMMAND patch -d <SOURCE_DIR> -p1 -i "${PATCHES_DIR}/icu-tarantool-security-61.patch"
COMMAND patch -d <SOURCE_DIR> -p1 -i "${PATCHES_DIR}/icu-tarantool-security-96.patch"
)
set(TARANTOOL_DEPENDS icu ${TARANTOOL_DEPENDS})
......
diff --git a/source/i18n/dangical.cpp b/source/i18n/dangical.cpp
index 234c44b..f5343d0 100644
--- a/source/i18n/dangical.cpp
+++ b/source/i18n/dangical.cpp
@@ -136,7 +136,7 @@ static void U_CALLCONV initDangiCalZoneAstroCalc(UErrorCode &status) {
ucln_i18n_registerCleanup(UCLN_I18N_DANGI_CALENDAR, calendar_dangi_cleanup);
}
-const TimeZone* DangiCalendar::getDangiCalZoneAstroCalc(UErrorCode &status) const {
+const TimeZone* DangiCalendar::getDangiCalZoneAstroCalc(UErrorCode &status) {
umtx_initOnce(gDangiCalendarInitOnce, &initDangiCalZoneAstroCalc, status);
return gDangiCalendarZoneAstroCalc;
}
diff --git a/source/i18n/dangical.h b/source/i18n/dangical.h
index 128f3af..e240272 100644
--- a/source/i18n/dangical.h
+++ b/source/i18n/dangical.h
@@ -74,7 +74,7 @@ class DangiCalendar : public ChineseCalendar {
private:
- const TimeZone* getDangiCalZoneAstroCalc(UErrorCode &status) const;
+ static const TimeZone* getDangiCalZoneAstroCalc(UErrorCode &status);
// UObject stuff
public:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment