diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-10-12 18:54:29 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-01-18 20:35:57 +0300 |
commit | 6a69f049274fcc22b462e3997596a28bef3feda6 (patch) | |
tree | 3469daedd1daebf2ea4218097b7f701274c1641c /libavcodec/vc1dec.c | |
parent | feeef2f80c24e86981d57d4a2e919d7d34bbcbfb (diff) |
avcodec/vc1dec: Allocate only as much space as is unescaped
Fixes: OOM
Fixes: 18137/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5723834900021248
Fixes: 20037/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5683758976204800
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/vc1dec.c')
-rw-r--r-- | libavcodec/vc1dec.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index c526b200b5..15783e3b8d 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -701,7 +701,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, goto err; } slices = tmp; - slices[n_slices].buf = av_mallocz(buf_size + AV_INPUT_BUFFER_PADDING_SIZE); + slices[n_slices].buf = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) { ret = AVERROR(ENOMEM); goto err; @@ -730,7 +730,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, goto err; } slices = tmp; - slices[n_slices].buf = av_mallocz(buf_size + AV_INPUT_BUFFER_PADDING_SIZE); + slices[n_slices].buf = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) { ret = AVERROR(ENOMEM); goto err; |