diff mbox series

[FFmpeg-devel,09/10] avcodec/vble: Allocate buffer later

Message ID 20240922215645.1182935-9-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,01/10] tools/target_dec_fuzzer: Add threshold for SRGC | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Sept. 22, 2024, 9:56 p.m. UTC
Fixes: Timeout
Fixes: 71727/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VBLE_fuzzer-6126342574243840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/vble.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Michael Niedermayer Sept. 24, 2024, 1:35 p.m. UTC | #1
On Sun, Sep 22, 2024 at 11:56:44PM +0200, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 71727/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VBLE_fuzzer-6126342574243840
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/vble.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavcodec/vble.c b/libavcodec/vble.c
index 4511433a6c9..c48feb9a591 100644
--- a/libavcodec/vble.c
+++ b/libavcodec/vble.c
@@ -130,10 +130,6 @@  static int vble_decode_frame(AVCodecContext *avctx, AVFrame *pic,
         return AVERROR_INVALIDDATA;
     }
 
-    /* Allocate buffer */
-    if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0)
-        return ret;
-
     /* Version should always be 1 */
     version = AV_RL32(src);
 
@@ -148,6 +144,10 @@  static int vble_decode_frame(AVCodecContext *avctx, AVFrame *pic,
         return AVERROR_INVALIDDATA;
     }
 
+    /* Allocate buffer */
+    if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0)
+        return ret;
+
     /* Restore planes. Should be almost identical to Huffyuv's. */
     vble_restore_plane(ctx, pic, &gb, 0, offset, avctx->width, avctx->height);