Check encoding results in DiffImages().
When image_diff encodes a bitmap to PNG, it should make sure the
operation succeeds.
Change-Id: I066d04bfdf314c600db14cb906abb01c375832cc
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/56714
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/testing/image_diff/image_diff.cpp b/testing/image_diff/image_diff.cpp
index 00116c7..f9d70f3 100644
--- a/testing/image_diff/image_diff.cpp
+++ b/testing/image_diff/image_diff.cpp
@@ -279,9 +279,11 @@
return kStatusSame;
std::vector<unsigned char> png_encoding;
- image_diff_png::EncodeRGBAPNG(diff_image.data(), diff_image.w(),
- diff_image.h(), diff_image.w() * 4,
- &png_encoding);
+ if (!image_diff_png::EncodeRGBAPNG(diff_image.data(), diff_image.w(),
+ diff_image.h(), diff_image.w() * 4,
+ &png_encoding)) {
+ return kStatusError;
+ }
FILE* f = fopen(out_file.c_str(), "wb");
if (!f)