diff mbox series

[FFmpeg-devel,3/9] avcodec/vble: Check av_image_get_buffer_size() for failure

Message ID 20240518035743.766552-3-michael@niedermayer.cc
State Accepted
Commit dd5379db5d83d8b06654582afe327daa6be678a3
Headers show
Series [FFmpeg-devel,1/9] avcodec/tiff: Assert init_get_bits8() success in horizontal_fill() | expand

Checks

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

Commit Message

Michael Niedermayer May 18, 2024, 3:57 a.m. UTC
Fixes: CID1461482 Improper use of negative value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/vble.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/vble.c b/libavcodec/vble.c
index 32157913c77..c585b1ed9fc 100644
--- a/libavcodec/vble.c
+++ b/libavcodec/vble.c
@@ -191,6 +191,9 @@  static av_cold int vble_decode_init(AVCodecContext *avctx)
     ctx->size = av_image_get_buffer_size(avctx->pix_fmt,
                                          avctx->width, avctx->height, 1);
 
+    if (ctx->size < 0)
+        return ctx->size;
+
     ctx->val = av_malloc_array(ctx->size, sizeof(*ctx->val));
 
     if (!ctx->val) {