if (!read_ushort(map, fsize, &position, &res2)) goto close_file;
if (!read_uint(map, fsize, &position, &offset)) goto close_file;
if (!read_uint(map, fsize, &position, &head_size)) goto close_file;
+ if (offset > fsize) goto close_file;
if (head_size == 12) // OS/2 V1 + Windows 3.0
{
short tmp;
if (!read_ushort(map, fsize, &position, &res2)) goto close_file;
if (!read_uint(map, fsize, &position, &offset)) goto close_file;
if (!read_uint(map, fsize, &position, &head_size)) goto close_file;
+ if (offset > fsize) goto close_file;
image_size = fsize - offset;
if (image_size < 1) goto close_file;