!2758 修复AIreview相关漏洞

Merge pull request !2758 from chenzhaohui/master
This commit is contained in:
openharmony_ci 2024-10-26 11:52:05 +00:00 committed by Gitee
commit 633c904ecc
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 10 additions and 2 deletions

View File

@ -472,6 +472,9 @@ void ImageUtils::DumpPixelMap(PixelMap* pixelMap, std::string customFileName, ui
#if !defined(IOS_PLATFORM) && !defined(ANDROID_PLATFORM)
if (pixelMap->GetAllocatorType() == AllocatorType::DMA_ALLOC) {
auto sbBuffer = reinterpret_cast<SurfaceBuffer*>(pixelMap->GetFd());
if (!sbBuffer) {
return;
}
totalSize = static_cast<int32_t>(sbBuffer->GetSize());
} else {
totalSize = static_cast<int32_t>(pixelMap->GetCapacity());

View File

@ -755,6 +755,7 @@ static std::shared_ptr<ImageSource> GetImageSourceFromNapi(napi_env env, napi_va
{
if (env == nullptr || value == nullptr) {
IMAGE_LOGE("GetImageSourceFromNapi input is null");
return nullptr;
}
std::unique_ptr<ImageSourceNapi> imageSourceNapi = std::make_unique<ImageSourceNapi>();
napi_status status = napi_unwrap(env, value, reinterpret_cast<void**>(&imageSourceNapi));

View File

@ -190,7 +190,11 @@ static ImageType ParserImageType(napi_env env, napi_value argv)
bool isInstance = false;
napi_status ret = napi_invalid_arg;
napi_get_global(env, &global);
ret = napi_get_global(env, &global);
if (ret != napi_ok) {
IMAGE_LOGI("Get global failed!");
return ImageType::TYPE_UNKNOWN;
}
ret = napi_get_named_property(env, global, "PixelMap", &constructor);
if (ret != napi_ok) {

View File

@ -893,7 +893,7 @@ uint32_t ExtDecoder::Decode(uint32_t index, DecodeContext &context)
return res;
}
SkCodec::Result ret = codec_->getPixels(dstInfo_, dstBuffer, rowStride, &dstOptions_);
if (ret != SkCodec::kSuccess && ResetCodec()) {
if (ret != SkCodec::kSuccess && ResetCodec() && skEncodeFormat != SkEncodedImageFormat::kHEIF) {
ret = codec_->getPixels(dstInfo_, dstBuffer, rowStride, &dstOptions_); // Try again
}
if (ret != SkCodec::kSuccess) {