diff options
author | Wei-Ta Chen <weita@google.com> | 2011-03-16 11:55:43 -0700 |
---|---|---|
committer | Wei-Ta Chen <weita@google.com> | 2011-03-16 13:30:10 -0700 |
commit | 6acf3dd4a350c51fd2b72ec990b7da6d5657e52a (patch) | |
tree | a9e68af300c90e69a8917d097498a4d0cc8512bc | |
parent | 7b81f64c8315ead539c7955fbc790e7596376119 (diff) | |
download | libpng-6acf3dd4a350c51fd2b72ec990b7da6d5657e52a.tar.gz |
Fix infinite loop in decoding a broken PNG.
Bug: 2982500
Change-Id: Ia971f7dfeffc3ccc30385b7b9c4f00394c8521ad
-rw-r--r-- | pngread.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -776,13 +776,18 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; break; } - if (ret != Z_OK) + if (ret != Z_OK) { #ifdef PNG_INDEX_SUPPORTED - if (png_ptr->index && png_ptr->row_number != png_ptr->height - 1) + if (png_ptr->index) { + if (png_ptr->row_number != png_ptr->height - 1) { + png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg : + "Decompression error"); + } + } else #endif png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg : - "Decompression error"); - + "Decompression error"); + } } while (png_ptr->zstream.avail_out); png_ptr->row_info.color_type = png_ptr->color_type; |