aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-02-18 23:14:16 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-01 12:49:26 +0200
commit76ad5d0351fd7d01c0ba07a4b6a7c4ed679f4ae7 (patch)
tree230a9197e8954271f7d1e8f4423ed60842c6ce99
parentae8e215c416d57631ac1759b3dfc2357c3b6de82 (diff)
downloadffmpeg-76ad5d0351fd7d01c0ba07a4b6a7c4ed679f4ae7.tar.gz
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@niedermayer.cc> (cherry picked from commit aeb4e435847e0c970bcb1a835fe5eda17a4e1ce3) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/txd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/txd.c b/libavcodec/txd.c
index d7fdde0872..4c7b976138 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);