History

lavc/pngdec: improve chunk length check

The length does not cover the chunk type or CRC.

Anton Khirnov committed 5 years ago

Commit ae08eec1 parent 8e4390d1 file · +1 −1Browse files

Unified · Split

libavcodec/pngdec.c+1−1
@@ -1217,7 +1217,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, · 1216 unmodified lines
1217 }1217 }
1218 1218
1219 length = bytestream2_get_be32(&s->gb);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 av_log(avctx, AV_LOG_ERROR, "chunk too big\n");1221 av_log(avctx, AV_LOG_ERROR, "chunk too big\n");
1222 ret = AVERROR_INVALIDDATA;1222 ret = AVERROR_INVALIDDATA;
1223 goto fail;1223 goto fail;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t