mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/tdsc: Only reallocate deflatebuffer if its size changed
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>
This commit is contained in:
parent
8821023b15
commit
8dff6da313
@ -529,10 +529,15 @@ static int tdsc_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
|
|
||||||
/* Resize deflate buffer on resolution change */
|
/* Resize deflate buffer on resolution change */
|
||||||
if (ctx->width != avctx->width || ctx->height != avctx->height) {
|
if (ctx->width != avctx->width || ctx->height != avctx->height) {
|
||||||
ctx->deflatelen = avctx->width * avctx->height * (3 + 1);
|
int deflatelen = avctx->width * avctx->height * (3 + 1);
|
||||||
ret = av_reallocp(&ctx->deflatebuffer, ctx->deflatelen);
|
if (deflatelen != ctx->deflatelen) {
|
||||||
if (ret < 0)
|
ctx->deflatelen =deflatelen;
|
||||||
return ret;
|
ret = av_reallocp(&ctx->deflatebuffer, ctx->deflatelen);
|
||||||
|
if (ret < 0) {
|
||||||
|
ctx->deflatelen = 0;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dlen = ctx->deflatelen;
|
dlen = ctx->deflatelen;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user