diff --git a/av_transport/av_trans_engine/plugin/plugins/av_trans_input/dsoftbus_input/dsoftbus_input_plugin.cpp b/av_transport/av_trans_engine/plugin/plugins/av_trans_input/dsoftbus_input/dsoftbus_input_plugin.cpp index e7f03ef1a28c41b49bac9a77c0ea9d4089702141..4c17ace85e34ef07331d9ae389796f69b69792fe 100644 --- a/av_transport/av_trans_engine/plugin/plugins/av_trans_input/dsoftbus_input/dsoftbus_input_plugin.cpp +++ b/av_transport/av_trans_engine/plugin/plugins/av_trans_input/dsoftbus_input/dsoftbus_input_plugin.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 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 @@ -295,7 +295,7 @@ std::shared_ptr DsoftbusInputPlugin::CreateBuffer(uint32_t metaType, return buffer; } cJSON *paramItem = cJSON_GetObjectItem(resMsg, AVT_DATA_PARAM.c_str()); - if (paramItem == NULL) { + if (paramItem == NULL || !cJSON_IsString(paramItem)) { return nullptr; } auto meta = std::make_shared(); diff --git a/av_transport/av_trans_handler/histreamer_ability_querier/src/histreamer_ability_querier.cpp b/av_transport/av_trans_handler/histreamer_ability_querier/src/histreamer_ability_querier.cpp index 2c746e1442cac36d6c1d18e61a8b11983135619a..fa51deb0a202a79a06c89c497b1f42852634b5e2 100644 --- a/av_transport/av_trans_handler/histreamer_ability_querier/src/histreamer_ability_querier.cpp +++ b/av_transport/av_trans_handler/histreamer_ability_querier/src/histreamer_ability_querier.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 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 @@ -970,7 +970,7 @@ template void FromJson(const std::string &key, const cJSON *jsonObject, std::vector &objs) { cJSON *objJson = cJSON_GetObjectItemCaseSensitive(jsonObject, key.c_str()); - if (objJson == nullptr) { + if (objJson == nullptr || !cJSON_IsArray(objJson)) { AVTRANS_LOGE("JSONObject key invalid, key: %{public}s", key.c_str()); return; }