[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

@@ -374,7 +374,7 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
/* row_bytes is the width x number of channels x (bit-depth / 8) */
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
if (height > ((size_t)(-1))/row_bytes) /* too big */ {
if (!rowbytes || height > ((size_t)(-1))/row_bytes) /* too big */ {
return FALSE;
}
if ((png_pixels = (png_byte *)