diff --git a/frameworks/innerkitsimpl/test/fuzztest/imagefwkimagesource2_fuzzer/src/image_fwk_image_source2_fuzzer.cpp b/frameworks/innerkitsimpl/test/fuzztest/imagefwkimagesource2_fuzzer/src/image_fwk_image_source2_fuzzer.cpp index 922f7a3f5bd87b495884886997dc740c7921c2c4..20f0d26bfe774ec0c88eacbea9e618296945091c 100644 --- a/frameworks/innerkitsimpl/test/fuzztest/imagefwkimagesource2_fuzzer/src/image_fwk_image_source2_fuzzer.cpp +++ b/frameworks/innerkitsimpl/test/fuzztest/imagefwkimagesource2_fuzzer/src/image_fwk_image_source2_fuzzer.cpp @@ -159,6 +159,7 @@ void CreateImageSourceByFDEXFuzz(const std::string &pathName) SetFdpDecodeOptions(FDP, dopts); if (imagesource != nullptr) { imagesource->CreatePixelMap(dopts, errorCode); + imagesource->RemoveImageProperties(0, {"ImageWidth", "ImageHeight"}, fd); } close(fd); } diff --git a/frameworks/innerkitsimpl/test/unittest/image_format_convert_test.cpp b/frameworks/innerkitsimpl/test/unittest/image_format_convert_test.cpp index affe02cfa957a33eed13e1aaa9e6c980f5ccef9d..bac1991d31175111555879dd26e0957a93d55f82 100644 --- a/frameworks/innerkitsimpl/test/unittest/image_format_convert_test.cpp +++ b/frameworks/innerkitsimpl/test/unittest/image_format_convert_test.cpp @@ -249,20 +249,27 @@ bool ImageFormatConvertTest::ReadFile(void *chOrg, std::string path, int32_t tot GTEST_LOG_(INFO) << "fopen"; return false; } + + bool result = true; if (srcNum == 0) { size_t bytesOrg = fread(chOrg, sizeof(uint8_t), static_cast(totalsize), fileOrg); if (bytesOrg < static_cast(totalsize)) { GTEST_LOG_(INFO) << "Read fail"; - return false; + result = false; } } else { size_t bytesOrg = fread(chOrg, sizeof(uint16_t), static_cast(totalsize), fileOrg); if (bytesOrg < static_cast(totalsize)) { - GTEST_LOG_(INFO) << "Read fail " << bytesOrg << " totalsize" << totalsize; - return false; + GTEST_LOG_(INFO) << "Read fail " << bytesOrg << " totalsize " << totalsize; + result = false; } } - return true; + + if (fclose(fileOrg) == EOF) { + GTEST_LOG_(INFO) << "fclose failed"; + result = false; + } + return result; } void ImageFormatConvertTest::YuvP010ConvertToRgb(PixelFormat &srcFormat, PixelFormat &destFormat, Size &srcSize, diff --git a/frameworks/innerkitsimpl/test/unittest/jpg_yuv_test.cpp b/frameworks/innerkitsimpl/test/unittest/jpg_yuv_test.cpp index 3afa311447a1c9afbd29b84c60569b44dc2d2acf..e290398e96ec080361a87eef1ddbe159b09b8403 100644 --- a/frameworks/innerkitsimpl/test/unittest/jpg_yuv_test.cpp +++ b/frameworks/innerkitsimpl/test/unittest/jpg_yuv_test.cpp @@ -602,20 +602,27 @@ bool JpgYuvTest::ReadFile(void *chOrg, std::string path, int32_t totalsize, int3 GTEST_LOG_(INFO) << "Cannot open" << path.c_str(); return false; } + + bool result = true; if (srcNum == 0) { size_t bytesOrg = fread(chOrg, sizeof(uint8_t), static_cast(totalsize), fileOrg); if (bytesOrg < static_cast(totalsize)) { GTEST_LOG_(INFO) << "Read fail"; - return false; + result = false; } } else { size_t bytesOrg = fread(chOrg, sizeof(uint16_t), static_cast(totalsize), fileOrg); if (bytesOrg < static_cast(totalsize)) { - GTEST_LOG_(INFO) << "Read fail " << bytesOrg << " totalsize" << totalsize; - return false; + GTEST_LOG_(INFO) << "Read fail " << bytesOrg << " totalsize " << totalsize; + result = false; } } - return true; + + if (fclose(fileOrg) == EOF) { + GTEST_LOG_(INFO) << "fclose failed"; + result = false; + } + return result; } void JpgYuvTest::YuvP010Crop(PixelFormat outfmt, std::string outname, ImageSize &imageSize)