PR #24474 opened by michaelni
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24474
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24474.patch

Fixes: read of uninitialized memory
Fixes: YwR11Eee5EpN
Found-by: zhang xingxing



>From a3389a44621a4fc4e9e5f543b05175c3b28a75f9 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Mon, 14 Sep 2026 02:11:16 +0200
Subject: [PATCH] avcodec/flashsv: require two bytes for a 15-bit pixel in
 decode_hybrid

Fixes: read of uninitialized memory
Fixes: YwR11Eee5EpN
Found-by: zhang xingxing
---
 libavcodec/flashsv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c
index ba5c995006..7503007d73 100644
--- a/libavcodec/flashsv.c
+++ b/libavcodec/flashsv.c
@@ -85,6 +85,8 @@ static int decode_hybrid(const uint8_t *sptr, const uint8_t 
*sptr_end, uint8_t *
             if (sptr >= sptr_end)
                 return AVERROR_INVALIDDATA;
             if (*sptr & 0x80) {
+                if (sptr + 2 > sptr_end)
+                    return AVERROR_INVALIDDATA;
                 /* 15-bit color */
                 unsigned c = AV_RB16(sptr) & ~0x8000;
                 unsigned b =  c        & 0x1F;
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to