mirror of
https://gitee.com/openharmony/global_i18n
synced 2024-11-27 09:11:40 +00:00
!649 CFI前向检查crash问题
Merge pull request !649 from zhangdd_ewan/cfi-240322
This commit is contained in:
commit
714433ef7b
@ -698,7 +698,8 @@ std::string I18nTimeZone::GetDisplayName(std::string localeStr)
|
||||
return GetDisplayName(localeStr, false);
|
||||
}
|
||||
|
||||
std::string I18nTimeZone::GetDisplayName(std::string localeStr, bool isDST)
|
||||
__attribute__((no_sanitize("cfi"))) std::string I18nTimeZone::GetDisplayName(
|
||||
std::string localeStr, bool isDST)
|
||||
{
|
||||
icu::TimeZone::EDisplayType style = icu::TimeZone::EDisplayType::LONG_GENERIC;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
@ -718,7 +719,8 @@ std::string I18nTimeZone::GetDisplayName(std::string localeStr, bool isDST)
|
||||
return GetDisplayNameByTaboo(localeStr, result);
|
||||
}
|
||||
|
||||
std::string I18nTimeZone::GetDisplayNameByTaboo(const std::string& localeStr, std::string result)
|
||||
__attribute__((no_sanitize("cfi"))) std::string I18nTimeZone::GetDisplayNameByTaboo(
|
||||
const std::string& localeStr, std::string result)
|
||||
{
|
||||
void *i18nUtilHandle = dlopen("libi18n_util.z.so", RTLD_NOW);
|
||||
if (i18nUtilHandle == nullptr) {
|
||||
|
@ -118,7 +118,8 @@ std::string PhoneNumberFormat::format(const std::string &number) const
|
||||
return formatted_number;
|
||||
}
|
||||
|
||||
std::string PhoneNumberFormat::getLocationName(const std::string &number, const std::string &locale)
|
||||
__attribute__((no_sanitize("cfi"))) std::string PhoneNumberFormat::getLocationName(
|
||||
const std::string &number, const std::string &locale)
|
||||
{
|
||||
// Combine country and locale parameters
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
@ -162,7 +163,8 @@ std::string PhoneNumberFormat::getLocationName(const std::string &number, const
|
||||
return getCityName(locale, formatted_number.substr(1), locName);
|
||||
}
|
||||
|
||||
std::string PhoneNumberFormat::getPhoneLocationName(const std::string& number, const std::string& phoneLocale,
|
||||
__attribute__((no_sanitize("cfi"))) std::string PhoneNumberFormat::getPhoneLocationName(
|
||||
const std::string& number, const std::string& phoneLocale,
|
||||
const std::string& displayLocale, const std::string& regionCode)
|
||||
{
|
||||
OpenHandler();
|
||||
@ -177,7 +179,9 @@ std::string PhoneNumberFormat::getPhoneLocationName(const std::string& number, c
|
||||
if (locationNameFunc) {
|
||||
// The function uses the same locale for phone and display.
|
||||
char recvArr[RECV_CHAR_LEN];
|
||||
locationNameFunc(number.c_str(), phoneLocale.c_str(), recvArr, RECV_CHAR_LEN);
|
||||
const char* numberArr = number.c_str();
|
||||
const char* phoneLocaleArr = phoneLocale.c_str();
|
||||
locationNameFunc(numberArr, phoneLocaleArr, recvArr, RECV_CHAR_LEN);
|
||||
locName = recvArr;
|
||||
}
|
||||
if (!locationNameFunc || locName.empty()) {
|
||||
@ -203,7 +207,8 @@ void PhoneNumberFormat::OpenHandler()
|
||||
}
|
||||
}
|
||||
|
||||
bool PhoneNumberFormat::getBlockedRegionName(const std::string& regionCode, const std::string& language)
|
||||
__attribute__((no_sanitize("cfi"))) bool PhoneNumberFormat::getBlockedRegionName(
|
||||
const std::string& regionCode, const std::string& language)
|
||||
{
|
||||
void *i18nUtilHandle = dlopen("libi18n_util.z.so", RTLD_NOW);
|
||||
if (i18nUtilHandle == nullptr) {
|
||||
@ -217,7 +222,8 @@ bool PhoneNumberFormat::getBlockedRegionName(const std::string& regionCode, cons
|
||||
}
|
||||
}
|
||||
|
||||
std::string PhoneNumberFormat::getCityName(const std::string& language, const std::string& phonenumber,
|
||||
__attribute__((no_sanitize("cfi"))) std::string PhoneNumberFormat::getCityName(
|
||||
const std::string& language, const std::string& phonenumber,
|
||||
const std::string& locationName)
|
||||
{
|
||||
char recvArr[RECV_CHAR_LEN];
|
||||
|
Loading…
Reference in New Issue
Block a user