[libpng16] Check for integer overflow in contrib/visupng.

This commit is contained in:
Glenn Randers-Pehrson
2017-04-23 17:33:10 -05:00
parent 0808d75851
commit 170a44b222
4 changed files with 17 additions and 3 deletions

View File

@@ -236,6 +236,10 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
free (pbImageData);
pbImageData = NULL;
}
if ((*piHeight) > ((size_t)(-1))/ulRowBytes) {
{
png_error(png_ptr, "Visual PNG: image is too big");
}
if ((pbImageData = (png_byte *) malloc(ulRowBytes * (*piHeight)
* sizeof(png_byte))) == NULL)
{