From 2e055999f04276d02af901dd54df8ac20ee5c6ac Mon Sep 17 00:00:00 2001 From: manh-td Date: Mon, 29 Dec 2025 17:06:48 +0800 Subject: [PATCH] Check image size when reading targa file --- src/TVTest_Image/libjpeg/rdtarga.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TVTest_Image/libjpeg/rdtarga.c b/src/TVTest_Image/libjpeg/rdtarga.c index 3ee77d61..bc4f2bb4 100644 --- a/src/TVTest_Image/libjpeg/rdtarga.c +++ b/src/TVTest_Image/libjpeg/rdtarga.c @@ -365,7 +365,8 @@ start_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) width <= 0 || height <= 0 || 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) {