!649 CFI前向检查crash问题

Merge pull request !649 from zhangdd_ewan/cfi-240322
This commit is contained in:
openharmony_ci 2024-03-25 04:09:12 +00:00 committed by Gitee
commit 714433ef7b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 15 additions and 7 deletions

View File

@ -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) {

View File

@ -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];