This should avoid long loops
related to CID1361958
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
for (g = 0; g < groups; g++) {
offset = bytestream2_get_be16(&gb);
- if (bytestream2_get_bytes_left(&gb) < 1)
+ if (cols * bpp == 0 || bytestream2_get_bytes_left(&gb) < cols * bpp)
return;
if (kludge_j)
for (d = 0; d < bpp; d++) {
unsigned noffset = offset + (r * pitch) + d * planepitch;
- if (bytestream2_get_bytes_left(&gb) < 1)
+ if (!bytes || bytestream2_get_bytes_left(&gb) < bytes)
return;
for (b = 0; b < bytes; b++) {