diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2018-07-01 21:19:57 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2018-07-04 12:14:00 +0200 |
commit | 4423085ca5009cd4c713798ce34fa3daeee0f27d (patch) | |
tree | 6157016493a05037005fe976596fa1d56b480958 | |
parent | 00f98d23b1462afb97116b947334db3754516207 (diff) | |
download | ffmpeg-streaming-4423085ca5009cd4c713798ce34fa3daeee0f27d.zip ffmpeg-streaming-4423085ca5009cd4c713798ce34fa3daeee0f27d.tar.gz |
avcodec/truemotion2: Check len in tm2_read_stream()
Fixes: Timeout
Fixes: 8774/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5942199639343104
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
-rw-r--r-- | libavcodec/truemotion2.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index b689efd..58a577f 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -377,6 +377,10 @@ static int tm2_read_stream(TM2Context *ctx, const uint8_t *buf, int stream_id, i } } } else { + if (len < 0) { + ret = AVERROR_INVALIDDATA; + goto end; + } for (i = 0; i < toks; i++) { ctx->tokens[stream_id][i] = codes.recode[0]; if (stream_id <= TM2_MOT && ctx->tokens[stream_id][i] >= TM2_DELTAS) { |