aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Sarett <msarett@google.com>2016-11-23 20:19:37 +0000
committerMatt Sarett <msarett@google.com>2016-11-23 20:19:37 +0000
commit991be70ee26a9a3933ae99cea52a51f1ef455dd5 (patch)
tree4c43f75942e5b22ce8bdd1b257d1517631237465
parent8c0c9e14afdd03610a9802eda4805a5f0d326375 (diff)
downloadlibpng-991be70ee26a9a3933ae99cea52a51f1ef455dd5.tar.gz
Revert "[libpng16] Revert ADLER32 error handling in pngrutil.c and pngpread.c."
This reverts commit 8c0c9e14afdd03610a9802eda4805a5f0d326375. https://b.corp.google.com/u/1/issues/33057876 Change-Id: I7be19ecda436bf2ee931fd9b0d334b5a4362574c
-rw-r--r--README.android4
-rw-r--r--pngpread.c7
-rw-r--r--pngrutil.c10
3 files changed, 15 insertions, 6 deletions
diff --git a/README.android b/README.android
index 32fb665f9..f6062c609 100644
--- a/README.android
+++ b/README.android
@@ -21,7 +21,3 @@ be listed here:
in contrib/intel/intel_sse.patch.
The patch was applied using the following command:
'patch -i contrib/intel/intel_sse.patch -p1'
-
-(5) Revert ADLER32 error handling to fix the infinite loop
-Cherry picked from upstream:
-https://github.com/glennrp/libpng/commit/d65a92b951079d315e17e20ba9e7b8423d19397e
diff --git a/pngpread.c b/pngpread.c
index 794352f42..650ba1e23 100644
--- a/pngpread.c
+++ b/pngpread.c
@@ -684,7 +684,12 @@ png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
png_warning(png_ptr, "Truncated compressed data in IDAT");
else
- png_error(png_ptr, "Decompression error in IDAT");
+ {
+ if (ret == Z_DATA_ERROR)
+ png_benign_error(png_ptr, "IDAT: ADLER32 checksum mismatch");
+ else
+ png_error(png_ptr, "Decompression error in IDAT");
+ }
/* Skip the check on unprocessed input */
return;
diff --git a/pngrutil.c b/pngrutil.c
index 339036749..fb5f5f083 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -4107,7 +4107,15 @@ png_read_IDAT_data(png_structrp png_ptr, png_bytep output,
png_zstream_error(png_ptr, ret);
if (output != NULL)
- png_chunk_error(png_ptr, png_ptr->zstream.msg);
+ {
+ if(!strncmp(png_ptr->zstream.msg,"incorrect data check",20))
+ {
+ png_chunk_benign_error(png_ptr, "ADLER32 checksum mismatch");
+ continue;
+ }
+ else
+ png_chunk_error(png_ptr, png_ptr->zstream.msg);
+ }
else /* checking */
{