diff --git a/common/src/utils/dh_log.cpp b/common/src/utils/dh_log.cpp index 4aa9ffa90f4855c949d29b4f65229b873aab9ab1..91403c9c07f08876df9b0de3d11a42c6194bed69 100644 --- a/common/src/utils/dh_log.cpp +++ b/common/src/utils/dh_log.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-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 @@ -76,8 +76,6 @@ void DHLog(DHLogLevel logLevel, const char *fmt, ...) { char logBuf[LOG_MAX_LEN] = {0}; va_list arg; - - (void)memset_s(&arg, sizeof(va_list), 0, sizeof(va_list)); va_start(arg, fmt); int32_t ret = vsprintf_s(logBuf, sizeof(logBuf), fmt, arg); va_end(arg); diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp index f99a23e7f883863f7738601e10ee3b51d2949e23..986624309becce1154be14d91f2ec996ff5ed47d 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp @@ -35,7 +35,9 @@ namespace DistributedHardware { DCameraClient::DCameraClient(const std::string& dhId) { DHLOGI("DCameraClient Constructor dhId: %{public}s", GetAnonyString(dhId).c_str()); - cameraId_ = dhId.substr(CAMERA_ID_PREFIX.size()); + if (dhId.size() >= CAMERA_ID_PREFIX.size()) { + cameraId_ = dhId.substr(CAMERA_ID_PREFIX.size()); + } isInit_ = false; } diff --git a/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/dcamera_stream_data_process.cpp b/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/dcamera_stream_data_process.cpp index 93daa0f1c578a2a51f38aa00f8400add87c110ad..5747a9b5f976b785799f37fb40f70cb358c5e234 100644 --- a/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/dcamera_stream_data_process.cpp +++ b/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/dcamera_stream_data_process.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-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 @@ -186,6 +186,7 @@ int32_t DCameraStreamDataProcess::GetProducerSize() void DCameraStreamDataProcess::FeedStreamToSnapShot(const std::shared_ptr& buffer) { + CHECK_AND_RETURN_LOG(buffer == nullptr, "buffer is nullptr."); uint64_t buffersSize = static_cast(buffer->Size()); DHLOGD("DCameraStreamDataProcess FeedStreamToSnapShot devId %{public}s dhId %{public}s streamType %{public}d " "streamSize: %{public}" PRIu64, GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str(), @@ -198,6 +199,7 @@ void DCameraStreamDataProcess::FeedStreamToSnapShot(const std::shared_ptr& buffer) { + CHECK_AND_RETURN_LOG(buffer == nullptr, "buffer is nullptr."); uint64_t buffersSize = static_cast(buffer->Size()); DHLOGD("DCameraStreamDataProcess FeedStreamToContinue devId %{public}s dhId %{public}s streamType %{public}d " "streamSize: %{public}" PRIu64, GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str(),