aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Bossen <frank@bossentech.com>2014-12-29 18:38:36 +0100
committerDRC <information@libjpeg-turbo.org>2015-08-14 11:42:23 -0500
commit82923eb93a2eacf4a593e00e3e672bbb86a8a3a0 (patch)
tree616194af2adde6937822981014f88090897d3ab1
parenta3ef34c626dc50d41a0949d53dadaf65cd99e6c0 (diff)
downloadlibjpeg-turbo-82923eb93a2eacf4a593e00e3e672bbb86a8a3a0.tar.gz
Check image size when reading targa file
Throw an error when image width or height is 0. Fixes mozilla/mozjpeg#140, closes #7.
-rw-r--r--rdtarga.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/rdtarga.c b/rdtarga.c
index afd17c43..b15ac647 100644
--- a/rdtarga.c
+++ b/rdtarga.c
@@ -364,7 +364,8 @@ start_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
if (cmaptype > 1 || /* cmaptype must be 0 or 1 */
source->pixel_size < 1 || source->pixel_size > 4 ||
(UCH(targaheader[16]) & 7) != 0 || /* bits/pixel must be multiple of 8 */
- interlace_type != 0) /* currently don't allow interlaced image */
+ interlace_type != 0 || /* currently don't allow interlaced image */
+ width == 0 || height == 0) /* image width/height must be non-zero */
ERREXIT(cinfo, JERR_TGA_BADPARMS);
if (subtype > 8) {