Make sure that palette entries don't exceed max.

This commit is contained in:
Themaister 2013-06-04 14:26:21 +02:00
parent cb8deab105
commit 1389346cbf

View File

@ -550,6 +550,9 @@ static bool png_append_idat(FILE *file, const struct png_chunk *chunk, struct id
static bool png_read_plte(FILE *file, uint32_t *buffer, unsigned entries)
{
if (entries > 256)
return false;
uint8_t buf[256 * 3];
if (fread(buf, 3, entries, file) != entries)
return false;