tiffdec,ReadTIFF: ensure data_size is < tsize_t max

Change-Id: I0ad9589a7f994294100e1c5a38abf6ebe417f8a9
This commit is contained in:
James Zern 2017-05-17 12:06:53 -07:00
parent d988eb7b39
commit dd7e83cca7

View File

@ -15,6 +15,7 @@
#include "webp/config.h"
#endif
#include <limits.h>
#include <stdio.h>
#include <string.h>
@ -162,7 +163,9 @@ int ReadTIFF(const uint8_t* const data, size_t data_size,
int ok = 0;
tdir_t dircount;
if (data == NULL || data_size == 0 || pic == NULL) return 0;
if (data == NULL || data_size == 0 || data_size > INT_MAX || pic == NULL) {
return 0;
}
tif = TIFFClientOpen("Memory", "r", &my_data,
MyRead, MyRead, MySeek, MyClose,