[FFmpeg-devel] [PATCH 3/4] avcodec/rv60: prevent decode_cu_r segfault

Peter Ross pross at xvid.org
Thu Nov 7 01:40:27 EET 2024


Fixes ticket #11289 (crash).
---
continuation of patch set: https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2024-November/335675.html

 libavcodec/rv60dec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/rv60dec.c b/libavcodec/rv60dec.c
index 86c7aefbca..8ec95e896f 100644
--- a/libavcodec/rv60dec.c
+++ b/libavcodec/rv60dec.c
@@ -2355,6 +2355,8 @@ static int rv60_decode_frame(AVCodecContext *avctx, AVFrame * frame,
     ofs = get_bits_count(&gb) / 8;
 
     for (int i = 0; i < s->cu_height; i++) {
+        if (header_size + ofs >= avpkt->size)
+            return AVERROR_INVALIDDATA;
         s->slice[i].data = avpkt->data + header_size + ofs;
         s->slice[i].data_size = FFMIN(s->slice[i].size, avpkt->size - header_size - ofs);
         ofs += s->slice[i].size;
-- 
2.45.2

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241107/5c17aeac/attachment.sig>


More information about the ffmpeg-devel mailing list