ffmpeg | branch: master | Michael Niedermayer <mich...@niedermayer.cc> | Sun 
Dec  8 01:23:39 2024 +0100| [34c06f52849a51c58a11ae530bd4c30012a3d6a0] | 
committer: Michael Niedermayer

avcodec/escape130: move get_buffer down

This way the (slow) allocation of an image is done after various additional 
checks

Fixes: Timeout
Fixes: 
379418967/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ESCAPE130_fuzzer-6507383574036480

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=34c06f52849a51c58a11ae530bd4c30012a3d6a0
---

 libavcodec/escape130.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/escape130.c b/libavcodec/escape130.c
index 3b0460fd79..4482a0e070 100644
--- a/libavcodec/escape130.c
+++ b/libavcodec/escape130.c
@@ -212,9 +212,6 @@ static int escape130_decode_frame(AVCodecContext *avctx, 
AVFrame *pic,
         return AVERROR_INVALIDDATA;
     }
 
-    if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
-        return ret;
-
     if ((ret = init_get_bits8(&gb, avpkt->data, avpkt->size)) < 0)
         return ret;
     skip_bits_long(&gb, 16 * 8);
@@ -310,6 +307,9 @@ static int escape130_decode_frame(AVCodecContext *avctx, 
AVFrame *pic,
         skip--;
     }
 
+    if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
+        return ret;
+
     new_y  = s->new_y;
     new_cb = s->new_u;
     new_cr = s->new_v;

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to