The length does not cover the chunk type or CRC.
Unified · Split
| @@ -1217,7 +1217,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, · 1216 unmodified lines | ||
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | 1219 | length = bytestream2_get_be32(&s->gb); |
| 1220 | − if (length > 0x7fffffff || length > bytestream2_get_bytes_left(&s->gb)) { | |
| 1220 | + if (length > 0x7fffffff || length + 8 > bytestream2_get_bytes_left(&s->gb)) { | |
| 1221 | 1221 | av_log(avctx, AV_LOG_ERROR, "chunk too big\n"); |
| 1222 | 1222 | ret = AVERROR_INVALIDDATA; |
| 1223 | 1223 | goto fail; |