Message ID | 20200618122026.24534-4-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | 8dff6da31305ba2f9ebf04e75ad86e1972271760 |
Headers | show |
Series | [FFmpeg-devel,1/4] avcodec/mv30: Fix integer overflows in idct2_1d() | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
On Thu, Jun 18, 2020 at 02:20:26PM +0200, Michael Niedermayer wrote: > Fixes: Timeout (47sec -> 35msec) > Fixes: 23375/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TDSC_fuzzer-5633949497032704 > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavcodec/tdsc.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) will apply [...]
diff --git a/libavcodec/tdsc.c b/libavcodec/tdsc.c index eaea41c1f5..cd03558ecd 100644 --- a/libavcodec/tdsc.c +++ b/libavcodec/tdsc.c @@ -530,10 +530,15 @@ static int tdsc_decode_frame(AVCodecContext *avctx, void *data, /* Resize deflate buffer on resolution change */ if (ctx->width != avctx->width || ctx->height != avctx->height) { - ctx->deflatelen = avctx->width * avctx->height * (3 + 1); - ret = av_reallocp(&ctx->deflatebuffer, ctx->deflatelen); - if (ret < 0) - return ret; + int deflatelen = avctx->width * avctx->height * (3 + 1); + if (deflatelen != ctx->deflatelen) { + ctx->deflatelen =deflatelen; + ret = av_reallocp(&ctx->deflatebuffer, ctx->deflatelen); + if (ret < 0) { + ctx->deflatelen = 0; + return ret; + } + } } dlen = ctx->deflatelen;
Fixes: Timeout (47sec -> 35msec) Fixes: 23375/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TDSC_fuzzer-5633949497032704 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavcodec/tdsc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)