[FFmpeg-cvslog] avcodec/txd: Check for input size against the header size.

Michael Niedermayer git at videolan.org
Sun Jul 5 20:49:47 EEST 2020


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Tue Feb 18 23:14:16 2020 +0100| [b055fa4b1c5a5e0e5365696ad63b80cf8ec1edc6] | committer: Michael Niedermayer

avcodec/txd: Check for input size against the header size.

Fixes: Timeout (21sec -> 80ms)
Fixes: 20673/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TXD_fuzzer-5177453863763968

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit aeb4e435847e0c970bcb1a835fe5eda17a4e1ce3)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b055fa4b1c5a5e0e5365696ad63b80cf8ec1edc6
---

 libavcodec/txd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/txd.c b/libavcodec/txd.c
index 0c95faaf89..09c191a2c4 100644
--- a/libavcodec/txd.c
+++ b/libavcodec/txd.c
@@ -43,6 +43,9 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     int i, j;
     int ret;
 
+    if (avpkt->size < 88)
+        return AVERROR_INVALIDDATA;
+
     ff_texturedsp_init(&dxtc);
 
     bytestream2_init(&gb, avpkt->data, avpkt->size);



More information about the ffmpeg-cvslog mailing list