已开启
Skip utf8 trans format expansion in Want::Marshalling for broker process #873
m0_65533854创建于 7 天前
Skip utf8 trans format expansion in Want::Marshalling for broker process #873
已开启
共 1 个文件变更+5-1
| @@ -20,6 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | + | ||
| 23 | 24 | ||
| 24 | 25 | ||
| 25 | 26 | ||
| @@ -48,6 +49,7 @@ namespace AAFwk { | |||
| 48 | namespace { | 49 | namespace { |
| 49 | const std::regex NUMBER_REGEX("^[-+]?([0-9]+)([.]([0-9]+))?$"); | 50 | const std::regex NUMBER_REGEX("^[-+]?([0-9]+)([.]([0-9]+))?$"); |
| 50 | const int32_t MAX_ALLOWED_SIZE(512 * 1024); | 51 | const int32_t MAX_ALLOWED_SIZE(512 * 1024); |
| 52 | +constexpr int32_t BROKER_UID = 5557; | ||
| 51 | 53 | ||
| 52 | nlohmann::json BuildWantJson(const Want &want) | 54 | nlohmann::json BuildWantJson(const Want &want) |
| 53 | { | 55 | { |
| @@ -1719,7 +1721,9 @@ bool Want::Marshalling(Parcel &parcel) const | |||
| 1719 | { | 1721 | { |
| 1720 | std::string ipcAction = GetAction(); | 1722 | std::string ipcAction = GetAction(); |
| 1721 | parcel.SetMaxCapacity(PARAM_WANT_CAPACITY_EXPANSION); | 1723 | parcel.SetMaxCapacity(PARAM_WANT_CAPACITY_EXPANSION); |
| 1722 | - if (GetBoolParam(Want::PARAM_STRING_TRANS_FORMAT_UTF8, false)) { | 1724 | + // broker process can not use the utf8 trans format expansion |
| 1725 | + auto selfUID = getuid(); | ||
| 1726 | + if (GetBoolParam(Want::PARAM_STRING_TRANS_FORMAT_UTF8, false) && selfUID != BROKER_UID) { | ||
| 1723 | bool needExpansion = true; | 1727 | bool needExpansion = true; |
| 1724 | ipcAction = PARAM_WANT_EXPANSION_TAG + ipcAction; | 1728 | ipcAction = PARAM_WANT_EXPANSION_TAG + ipcAction; |
| 1725 | parameters_.SetNeedExpansion(needExpansion); // add expand capacity flag | 1729 | parameters_.SetNeedExpansion(needExpansion); // add expand capacity flag |