bitbuf = bytestream2_get_le16u(gb);
mask = 1;
}
- if (frame_end - frame < 2)
- return AVERROR_INVALIDDATA;
+
if (bitbuf & mask) {
v = bytestream2_get_le16(gb);
offset = (v & 0x1FFF) << 2;
frame += 2;
}
} else if (bitbuf & (mask << 1)) {
- frame += bytestream2_get_le16(gb) * 2;
+ v = bytestream2_get_le16(gb)*2;
+ if (frame - frame_end < v)
+ return AVERROR_INVALIDDATA;
+ frame += v;
} else {
- if (frame_end - frame < width + 2)
+ if (frame_end - frame < width + 3)
return AVERROR_INVALIDDATA;
frame[0] = frame[1] =
frame[width] = frame[width + 1] = bytestream2_get_byte(gb);