From 868ba53252501cc4a9ad8bbd4b26c71fec98cf12 Mon Sep 17 00:00:00 2001 From: Tome Date: Thu, 7 Aug 2025 11:15:05 +0800 Subject: [PATCH] =?UTF-8?q?AI=20=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tome --- .../multimedia_codec/encoder/encode_data_process.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/services/data_process/src/pipeline_node/multimedia_codec/encoder/encode_data_process.cpp b/services/data_process/src/pipeline_node/multimedia_codec/encoder/encode_data_process.cpp index 10939282..15571aaa 100644 --- a/services/data_process/src/pipeline_node/multimedia_codec/encoder/encode_data_process.cpp +++ b/services/data_process/src/pipeline_node/multimedia_codec/encoder/encode_data_process.cpp @@ -476,8 +476,15 @@ int32_t EncodeDataProcess::GetEncoderOutputBuffer(uint32_t index, MediaAVCodec:: size_t outputMemoDataSize = static_cast(info.size); CHECK_AND_RETURN_RET_LOG(buffer->GetBase() == nullptr, DCAMERA_BAD_OPERATE, "Sink point check failed: Source buffer base is null."); - CHECK_AND_RETURN_RET_LOG(outputMemoDataSize > buffer->GetSize(), DCAMERA_BAD_VALUE, - "Sink point check failed: outputMemoDataSize exceeds source allocated size."); + int64_t sourceAllocatedSize = buffer->GetSize(); + if (sourceAllocatedSize < 0) { + DHLOGE("Sink point check failed: buffer->GetSize() returned a negative error code."); + return DCAMERA_BAD_VALUE; + } + if (outputMemoDataSize > static_cast(sourceAllocatedSize)) { + DHLOGE("Sink point check failed: outputMemoDataSize exceeds source allocated size."); + return DCAMERA_BAD_VALUE; + } DHLOGD("Encoder output buffer size : %{public}zu", outputMemoDataSize); std::shared_ptr bufferOutput = std::make_shared(outputMemoDataSize); CHECK_AND_RETURN_RET_LOG(bufferOutput->Data() == nullptr, DCAMERA_MEMORY_OPT_ERROR, -- Gitee