From 4b2d4f3174597ce1ecc2f2594d231166cabcd545 Mon Sep 17 00:00:00 2001 From: gaoqiang_strong Date: Thu, 22 Dec 2022 16:27:59 +0800 Subject: [PATCH 1/3] check json data Signed-off-by: gaoqiang_strong --- common/BUILD.gn | 2 + common/include/dscreen_constants.h | 1 + common/include/dscreen_json_util.h | 33 +++++++ common/src/dscreen_json_util.cpp | 97 +++++++++++++++++++ .../utils/include/dscreen_maprelation.h | 4 +- .../common/utils/src/dscreen_maprelation.cpp | 33 +++++-- services/common/utils/src/video_param.cpp | 21 ++-- .../include/screen_client_common.h | 4 +- .../screenregionmgr/include/screenregionmgr.h | 1 + .../screenregionmgr/src/screenregionmgr.cpp | 21 +++- .../dscreenmgr/include/dscreen_manager.h | 1 + .../sourceservice/dscreenmgr/src/dscreen.cpp | 7 +- .../dscreenmgr/src/dscreen_manager.cpp | 25 +++-- 13 files changed, 216 insertions(+), 34 deletions(-) create mode 100644 common/include/dscreen_json_util.h create mode 100644 common/src/dscreen_json_util.cpp diff --git a/common/BUILD.gn b/common/BUILD.gn index f972803c..5eb2ebcf 100644 --- a/common/BUILD.gn +++ b/common/BUILD.gn @@ -22,10 +22,12 @@ ohos_shared_library("distributed_screen_utils") { "include", "//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include", "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include/hitrace_meter", + "//third_party/json/include", ] sources = [ "src/dscreen_hisysevent.cpp", + "src/dscreen_json_util.cpp", "src/dscreen_log.cpp", "src/dscreen_sa_process_state.cpp", "src/dscreen_util.cpp", diff --git a/common/include/dscreen_constants.h b/common/include/dscreen_constants.h index e3f55a66..629783d1 100644 --- a/common/include/dscreen_constants.h +++ b/common/include/dscreen_constants.h @@ -130,6 +130,7 @@ const std::string SINK_PROJ_SHOW_HEIGHT = "sinkProjShowHeight"; const std::string SINK_WIN_SHOW_X = "sinkWinShowX"; const std::string SINK_WIN_SHOW_Y = "sinkWinShowY"; +constexpr uint32_t MAX_MESSAGE_LEN = 40 * 1024 * 1024; constexpr float DEFAULT_DENSITY = 2.0; constexpr int32_t DEFAULT_SCREEN_FLAGS = 0; constexpr uint32_t DEFAULT_FPS = 30; diff --git a/common/include/dscreen_json_util.h b/common/include/dscreen_json_util.h new file mode 100644 index 00000000..877b64f0 --- /dev/null +++ b/common/include/dscreen_json_util.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_DSCREEN_JSON_UTIL_H +#define OHOS_DSCREEN_JSON_UTIL_H + +#include "nlohmann/json.hpp" + +namespace OHOS { +namespace DistributedHardware { +bool IsString(const nlohmann::json &jsonObj, const std::string &key); +bool IsUInt8(const nlohmann::json &jsonObj, const std::string &key); +bool IsInt32(const nlohmann::json &jsonObj, const std::string &key); +bool IsUInt32(const nlohmann::json &jsonObj, const std::string &key); +bool IsInt64(const nlohmann::json &jsonObj, const std::string &key); +bool IsUInt64(const nlohmann::json &jsonObj, const std::string &key); +bool IsArray(const nlohmann::json &jsonObj, const std::string &key); +bool IsBool(const nlohmann::json &jsonObj, const std::string &key); +} // namespace DistributedHardware +} // namespace OHOS +#endif \ No newline at end of file diff --git a/common/src/dscreen_json_util.cpp b/common/src/dscreen_json_util.cpp new file mode 100644 index 00000000..408270e9 --- /dev/null +++ b/common/src/dscreen_json_util.cpp @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "dscreen_json_util.h" + +#include "dscreen_constants.h" +#include "dscreen_log.h" + +namespace OHOS { +namespace DistributedHardware { +bool IsString(const nlohmann::json &jsonObj, const std::string &key) +{ + bool res = jsonObj.contains(key) && jsonObj[key].is_string() && jsonObj[key].size() <= MAX_MESSAGE_LEN; + if (!res) { + DHLOGE("the key %s in jsonObj is invalid.", key.c_str()); + } + return res; +} + +bool IsUInt8(const nlohmann::json &jsonObj, const std::string &key) +{ + bool res = jsonObj.contains(key) && jsonObj[key].is_number_unsigned() && jsonObj[key] <= UINT8_MAX; + if (!res) { + DHLOGE("the key %s in jsonObj is invalid.", key.c_str()); + } + return res; +} + +bool IsInt32(const nlohmann::json &jsonObj, const std::string &key) +{ + bool res = jsonObj.contains(key) && jsonObj[key].is_number_integer() && jsonObj[key] >= INT32_MIN && + jsonObj[key] <= INT32_MAX; + if (!res) { + DHLOGE("the key %s in jsonObj is invalid.", key.c_str()); + } + return res; +} + +bool IsUInt32(const nlohmann::json &jsonObj, const std::string &key) +{ + bool res = jsonObj.contains(key) && jsonObj[key].is_number_unsigned() && jsonObj[key] <= UINT32_MAX; + if (!res) { + DHLOGE("the key %s in jsonObj is invalid.", key.c_str()); + } + return res; +} + +bool IsInt64(const nlohmann::json &jsonObj, const std::string &key) +{ + bool res = jsonObj.contains(key) && jsonObj[key].is_number_integer() && jsonObj[key] >= INT64_MIN && + jsonObj[key] <= INT64_MAX; + if (!res) { + DHLOGE("the key %s in jsonObj is invalid.", key.c_str()); + } + return res; +} + +bool IsUInt64(const nlohmann::json &jsonObj, const std::string &key) +{ + bool res = jsonObj.contains(key) && jsonObj[key].is_number_unsigned() && jsonObj[key] <= UINT64_MAX; + if (!res) { + DHLOGE("the key %s in jsonObj is invalid.", key.c_str()); + } + return res; +} + +bool IsArray(const nlohmann::json &jsonObj, const std::string &key) +{ + bool res = jsonObj.contains(key) && jsonObj[key].is_array(); + if (!res) { + DHLOGE("the key %s in jsonObj is invalid.", key.c_str()); + } + return res; +} + +bool IsBool(const nlohmann::json &jsonObj, const std::string &key) +{ + bool res = jsonObj.contains(key) && jsonObj[key].is_boolean(); + if (!res) { + DHLOGE("the key %s in jsonObj is invalid.", key.c_str()); + } + return res; +} +} // namespace DistributedHardware +} // namespace OHOS \ No newline at end of file diff --git a/services/common/utils/include/dscreen_maprelation.h b/services/common/utils/include/dscreen_maprelation.h index 25c44027..e63ea17e 100644 --- a/services/common/utils/include/dscreen_maprelation.h +++ b/services/common/utils/include/dscreen_maprelation.h @@ -25,8 +25,8 @@ namespace DistributedHardware { struct ScreenRect { int32_t startX; int32_t startY; - uint16_t width; - uint16_t height; + uint32_t width; + uint32_t height; }; struct DisplayRect { int32_t startX; diff --git a/services/common/utils/src/dscreen_maprelation.cpp b/services/common/utils/src/dscreen_maprelation.cpp index 28db6e2e..d8f89652 100644 --- a/services/common/utils/src/dscreen_maprelation.cpp +++ b/services/common/utils/src/dscreen_maprelation.cpp @@ -17,6 +17,7 @@ #include "dscreen_constants.h" #include "dscreen_errcode.h" +#include "dscreen_json_util.h" using json = nlohmann::json; @@ -78,8 +79,12 @@ void to_json(json &j, const DScreenMapRelation &dScreenMapRelation) void from_json(const json &j, DScreenMapRelation &dScreenMapRelation) { - j.at(KEY_DISPLAY_ID).get_to(dScreenMapRelation.displayId_); - j.at(KEY_SCREEN_ID).get_to(dScreenMapRelation.screenId_); + if (!IsUInt64(j, KEY_DISPLAY_ID) || !IsUInt64(j, KEY_SCREEN_ID)) { + return; + } + dScreenMapRelation.displayId_ = j[KEY_DISPLAY_ID].get(); + dScreenMapRelation.screenId_ = j[KEY_SCREEN_ID].get(); + from_json(j.at(KEY_DISPLAY_RECT), dScreenMapRelation.displayRect_); from_json(j.at(KEY_SCREEN_RECT), dScreenMapRelation.screenRect_); } @@ -96,10 +101,14 @@ void to_json(json &j, const DisplayRect &rect) void from_json(const json &j, DisplayRect &rect) { - j.at(KEY_POINT_START_X).get_to(rect.startX); - j.at(KEY_POINT_START_Y).get_to(rect.startY); - j.at(KEY_WIDTH).get_to(rect.width); - j.at(KEY_HEIGHT).get_to(rect.height); + if (!IsInt32(j, KEY_POINT_START_X) || !IsInt32(j, KEY_POINT_START_Y) || + !IsInt32(j, KEY_WIDTH) || !IsInt32(j, KEY_HEIGHT)) { + return; + } + rect.startX = j[KEY_POINT_START_X].get(); + rect.startY = j[KEY_POINT_START_Y].get(); + rect.width = j[KEY_WIDTH].get(); + rect.height = j[KEY_HEIGHT].get(); } void to_json(json &j, const ScreenRect &rect) @@ -114,10 +123,14 @@ void to_json(json &j, const ScreenRect &rect) void from_json(const json &j, ScreenRect &rect) { - j.at(KEY_POINT_START_X).get_to(rect.startX); - j.at(KEY_POINT_START_Y).get_to(rect.startY); - j.at(KEY_WIDTH).get_to(rect.width); - j.at(KEY_HEIGHT).get_to(rect.height); + if (!IsInt32(j, KEY_POINT_START_X) || !IsInt32(j, KEY_POINT_START_Y) || + !IsUInt32(j, KEY_WIDTH) || !IsUInt32(j, KEY_HEIGHT)) { + return; + } + rect.startX = j[KEY_POINT_START_X].get(); + rect.startY = j[KEY_POINT_START_Y].get(); + rect.width = j[KEY_WIDTH].get(); + rect.height = j[KEY_HEIGHT].get(); } } // namespace DistributedHardware } // namespace OHOS \ No newline at end of file diff --git a/services/common/utils/src/video_param.cpp b/services/common/utils/src/video_param.cpp index 0b6d2b9f..561c7ac2 100644 --- a/services/common/utils/src/video_param.cpp +++ b/services/common/utils/src/video_param.cpp @@ -15,6 +15,7 @@ #include "video_param.h" #include "dscreen_constants.h" +#include "dscreen_json_util.h" using json = nlohmann::json; @@ -105,13 +106,19 @@ void to_json(json &j, const DistributedHardware::VideoParam &videoParam) void from_json(const json &j, DistributedHardware::VideoParam &videoParam) { - j.at(KEY_SCREEN_WIDTH).get_to(videoParam.screenWidth_); - j.at(KEY_SCREEN_HEIGHT).get_to(videoParam.screenHeight_); - j.at(KEY_VIDEO_WIDTH).get_to(videoParam.videoWidth_); - j.at(KEY_VIDEO_HEIGHT).get_to(videoParam.videoHeight_); - j.at(KEY_FPS).get_to(videoParam.fps_); - j.at(KEY_CODECTYPE).get_to(videoParam.codecType_); - j.at(KEY_COLOR_FORMAT).get_to(videoParam.videoFormat_); + if (!IsUInt32(j, KEY_SCREEN_WIDTH) || !IsUInt32(j, KEY_SCREEN_HEIGHT) || + !IsUInt32(j, KEY_VIDEO_WIDTH) || !IsUInt32(j, KEY_VIDEO_HEIGHT) || + !IsUInt32(j, KEY_FPS) || !IsUInt8(j, KEY_CODECTYPE) || !IsUInt8(j, KEY_COLOR_FORMAT)) { + return; + } + + videoParam.screenWidth_ = j[KEY_SCREEN_WIDTH].get(); + videoParam.screenHeight_ = j[KEY_SCREEN_HEIGHT].get(); + videoParam.videoWidth_ = j[KEY_VIDEO_WIDTH].get(); + videoParam.videoHeight_ = j[KEY_VIDEO_HEIGHT].get(); + videoParam.fps_ = j[KEY_FPS].get(); + videoParam.codecType_ = j[KEY_CODECTYPE].get(); + videoParam.videoFormat_ = j[KEY_COLOR_FORMAT].get(); } } // namespace DistributedHardware } // namespace OHOS diff --git a/services/screenclient/include/screen_client_common.h b/services/screenclient/include/screen_client_common.h index 431cc212..2cc8e3f4 100644 --- a/services/screenclient/include/screen_client_common.h +++ b/services/screenclient/include/screen_client_common.h @@ -23,8 +23,8 @@ struct WindowProperty { uint64_t displayId; int32_t startX; int32_t startY; - uint16_t width; - uint16_t height; + uint32_t width; + uint32_t height; }; } // namespace DistributedHardware } // namespace OHOS diff --git a/services/screenservice/sinkservice/screenregionmgr/include/screenregionmgr.h b/services/screenservice/sinkservice/screenregionmgr/include/screenregionmgr.h index 0495174f..b3a1b5f1 100644 --- a/services/screenservice/sinkservice/screenregionmgr/include/screenregionmgr.h +++ b/services/screenservice/sinkservice/screenregionmgr/include/screenregionmgr.h @@ -46,6 +46,7 @@ private: sptr GetDScreenSourceSA(const std::string &devId); int32_t NotifyRemoteScreenService(const std::string &remoteDevId, const std::string &dhId, int32_t eventCode, const std::string &eventContent); + bool CheckContentJson(json &eventContentJson); void HandleNotifySetUp(const std::string &remoteDevId, const std::string &eventContent); void NotifyRemoteSourceSetUpResult(const std::string &remoteDevId, const std::string &dhId, int32_t errCode, const std::string &errContent); diff --git a/services/screenservice/sinkservice/screenregionmgr/src/screenregionmgr.cpp b/services/screenservice/sinkservice/screenregionmgr/src/screenregionmgr.cpp index 54bb00e1..9c67e483 100644 --- a/services/screenservice/sinkservice/screenregionmgr/src/screenregionmgr.cpp +++ b/services/screenservice/sinkservice/screenregionmgr/src/screenregionmgr.cpp @@ -23,6 +23,7 @@ #include "dscreen_constants.h" #include "dscreen_errcode.h" #include "dscreen_fwkkit.h" +#include "dscreen_json_util.h" #include "dscreen_log.h" #include "dscreen_maprelation.h" #include "dscreen_util.h" @@ -112,6 +113,17 @@ void ScreenRegionManager::GetScreenDumpInfo(std::string &result) result.append(" }\n]"); } +bool ScreenRegionManager::CheckContentJson(json &eventContentJson) +{ + if (!IsUInt64(eventContentJson, KEY_SCREEN_ID)) { + return false; + } + if (!IsString(eventContentJson, KEY_DH_ID)) { + return false; + } + return true; +} + void ScreenRegionManager::HandleNotifySetUp(const std::string &remoteDevId, const std::string &eventContent) { DHLOGI("HandleNotifySetUp, remoteDevId: %s", GetAnonyString(remoteDevId).c_str()); @@ -121,14 +133,15 @@ void ScreenRegionManager::HandleNotifySetUp(const std::string &remoteDevId, cons return; } - if (!eventContentJson.contains(KEY_SCREEN_ID) || !eventContentJson.contains(KEY_DH_ID) || - !eventContentJson.contains(KEY_VIDEO_PARAM) || !eventContentJson.contains(KEY_MAPRELATION)) { + if (!CheckContentJson(eventContentJson) || !eventContentJson.contains(KEY_VIDEO_PARAM) || + !eventContentJson.contains(KEY_MAPRELATION)) { NotifyRemoteSourceSetUpResult(remoteDevId, "", ERR_DH_SCREEN_SA_SCREENREGION_SETUP_FAIL, ""); return; } - uint64_t screenId = eventContentJson[KEY_SCREEN_ID]; - std::string dhId = eventContentJson[KEY_DH_ID]; + uint64_t screenId = eventContentJson[KEY_SCREEN_ID].get(); + std::string dhId = eventContentJson[KEY_DH_ID].get(); + std::shared_ptr videoParam = std::make_shared(eventContentJson[KEY_VIDEO_PARAM].get()); std::shared_ptr mapRelation = diff --git a/services/screenservice/sourceservice/dscreenmgr/include/dscreen_manager.h b/services/screenservice/sourceservice/dscreenmgr/include/dscreen_manager.h index df558954..bc5db4dc 100644 --- a/services/screenservice/sourceservice/dscreenmgr/include/dscreen_manager.h +++ b/services/screenservice/sourceservice/dscreenmgr/include/dscreen_manager.h @@ -78,6 +78,7 @@ private: sptr GetDScreenSinkSA(const std::string &devId); int32_t NotifyRemoteScreenService(const std::string &devId, int32_t eventCode, const std::string &eventContent); void NotifyRemoteSinkSetUp(const std::shared_ptr &dScreen); + bool CheckContent(json &eventContent); void HandleNotifySetUpResult(const std::string &remoteDevId, const std::string &eventContent); }; } // namespace DistributedHardware diff --git a/services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp b/services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp index 3f0510dc..b85442c3 100644 --- a/services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp +++ b/services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp @@ -21,6 +21,7 @@ #include "dscreen_constants.h" #include "dscreen_errcode.h" #include "dscreen_hisysevent.h" +#include "dscreen_json_util.h" #include "dscreen_log.h" #include "dscreen_util.h" #include "screen_manager_adapter.h" @@ -204,8 +205,8 @@ void DScreen::HandleEnable(const std::string ¶m, const std::string &taskId) return; } - videoParam_->SetScreenWidth(attrJson[KEY_SCREEN_WIDTH]); - videoParam_->SetScreenHeight(attrJson[KEY_SCREEN_HEIGHT]); + videoParam_->SetScreenWidth(attrJson[KEY_SCREEN_WIDTH].get()); + videoParam_->SetScreenHeight(attrJson[KEY_SCREEN_HEIGHT].get()); // negotiate codecType ret = NegotiateCodecType(attrJson[KEY_CODECTYPE]); @@ -241,7 +242,7 @@ int32_t DScreen::CheckJsonData(json &attrJson) return ERR_DH_SCREEN_SA_ENABLE_JSON_ERROR; } - if (!attrJson.contains(KEY_SCREEN_WIDTH) || !attrJson.contains(KEY_SCREEN_HEIGHT) || + if (!IsUInt32(attrJson, KEY_SCREEN_WIDTH) || !IsUInt32(attrJson, KEY_SCREEN_HEIGHT) || !attrJson.contains(KEY_CODECTYPE)) { DHLOGE("enable param is invalid."); return ERR_DH_SCREEN_SA_ENABLE_JSON_ERROR; diff --git a/services/screenservice/sourceservice/dscreenmgr/src/dscreen_manager.cpp b/services/screenservice/sourceservice/dscreenmgr/src/dscreen_manager.cpp index e39c290d..139a076e 100644 --- a/services/screenservice/sourceservice/dscreenmgr/src/dscreen_manager.cpp +++ b/services/screenservice/sourceservice/dscreenmgr/src/dscreen_manager.cpp @@ -24,6 +24,7 @@ #include "dscreen_constants.h" #include "dscreen_errcode.h" #include "dscreen_fwkkit.h" +#include "dscreen_json_util.h" #include "dscreen_log.h" #include "dscreen_util.h" #include "idscreen_sink.h" @@ -484,6 +485,20 @@ void DScreenManager::NotifyRemoteSinkSetUp(const std::shared_ptr &dScre NotifyRemoteScreenService(devId, eventCode, eventContent); } +bool DScreenManager::CheckContent(json &eventContent) +{ + if (!IsString(eventContent, KEY_DH_ID)) { + return false; + } + if (!IsInt32(eventContent, KEY_ERR_CODE)) { + return false; + } + if (!IsString(eventContent, KEY_ERR_CONTENT)) { + return false; + } + return true; +} + void DScreenManager::HandleNotifySetUpResult(const std::string &remoteDevId, const std::string &eventContent) { DHLOGI("HandleNotifySetUpResult, remoteDevId:%s", GetAnonyString(remoteDevId).c_str()); @@ -493,16 +508,14 @@ void DScreenManager::HandleNotifySetUpResult(const std::string &remoteDevId, con return; } - if (!eventContentJson.contains(KEY_DH_ID) || - !eventContentJson.contains(KEY_ERR_CODE) || - !eventContentJson.contains(KEY_ERR_CONTENT)) { + if (!CheckContent(eventContentJson)) { DHLOGE("HandleNotifySetUpResult, eventContent is invalid"); return; } - std::string dhId = eventContentJson[KEY_DH_ID]; - int32_t errCode = eventContentJson[KEY_ERR_CODE]; - std::string errContent = eventContentJson[KEY_ERR_CONTENT]; + std::string dhId = eventContentJson[KEY_DH_ID].get(); + int32_t errCode = eventContentJson[KEY_ERR_CODE].get(); + std::string errContent = eventContentJson[KEY_ERR_CONTENT].get(); std::string dScreenIdx = remoteDevId + SEPERATOR + dhId; std::lock_guard lock(dScreenMapMtx_); -- Gitee From a4232608c5a39c705f41963d610bf21b30c2fb93 Mon Sep 17 00:00:00 2001 From: gaoqiang Date: Sat, 24 Dec 2022 03:34:24 +0000 Subject: [PATCH 2/3] update services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp. -sm "fix" Signed-off-by: gaoqiang --- services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp b/services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp index b85442c3..eaef12e4 100644 --- a/services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp +++ b/services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp @@ -243,7 +243,7 @@ int32_t DScreen::CheckJsonData(json &attrJson) } if (!IsUInt32(attrJson, KEY_SCREEN_WIDTH) || !IsUInt32(attrJson, KEY_SCREEN_HEIGHT) || - !attrJson.contains(KEY_CODECTYPE)) { + !IsString(attrJson, KEY_CODECTYPE)) { DHLOGE("enable param is invalid."); return ERR_DH_SCREEN_SA_ENABLE_JSON_ERROR; } -- Gitee From 31f9d2ec6cc36d71723a8406e88637c3d88bbdd0 Mon Sep 17 00:00:00 2001 From: gaoqiang Date: Mon, 26 Dec 2022 02:11:56 +0000 Subject: [PATCH 3/3] update services/common/utils/src/dscreen_maprelation.cpp. -sm "fix codex" Signed-off-by: gaoqiang --- services/common/utils/src/dscreen_maprelation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/common/utils/src/dscreen_maprelation.cpp b/services/common/utils/src/dscreen_maprelation.cpp index d8f89652..57d3db3e 100644 --- a/services/common/utils/src/dscreen_maprelation.cpp +++ b/services/common/utils/src/dscreen_maprelation.cpp @@ -129,8 +129,8 @@ void from_json(const json &j, ScreenRect &rect) } rect.startX = j[KEY_POINT_START_X].get(); rect.startY = j[KEY_POINT_START_Y].get(); - rect.width = j[KEY_WIDTH].get(); - rect.height = j[KEY_HEIGHT].get(); + rect.width = j[KEY_WIDTH].get(); + rect.height = j[KEY_HEIGHT].get(); } } // namespace DistributedHardware } // namespace OHOS \ No newline at end of file -- Gitee