mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] Document need to check for integer overflow when allocating a pixel
buffer for multiple rows in contrib/gregbook, contrib/pngminus, example.c, and in the manual (suggested by Jaeseung Choi).
This commit is contained in:
@@ -373,6 +373,9 @@ 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 */ {
|
||||
return FALSE;
|
||||
}
|
||||
if ((png_pixels = (png_byte *)
|
||||
malloc (row_bytes * height * sizeof (png_byte))) == NULL)
|
||||
return FALSE;
|
||||
|
||||
Reference in New Issue
Block a user