[libpng16] Check for 0 return from png_get_rowbytes() in contrib/pngminus/*.c

to stop some Coverity issues (162705, 162706, and 162707).
This commit is contained in:
Glenn Randers-Pehrson
2017-08-07 14:22:56 -05:00
parent 06ec4252a4
commit 646fad9d55
4 changed files with 22 additions and 10 deletions

View File

@@ -321,7 +321,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
/* row_bytes is the width x number of channels x (bit-depth / 8) */
row_bytes = png_get_rowbytes (png_ptr, info_ptr);
if (height > ((size_t)(-1))/row_bytes) /* too big */ {
if (!row_bytes || height > ((size_t)(-1))/row_bytes) /* too big */ {
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
return FALSE;
}