[FFmpeg-cvslog] avcodec/rtv1: stop returning incomplete frames

Paul B Mahol git at videolan.org
Sun Sep 24 15:27:38 EEST 2023


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Sep 24 14:13:23 2023 +0200| [13a3e2a9b4697a1403d3e58eb5e8ef9c72561d54] | committer: Paul B Mahol

avcodec/rtv1: stop returning incomplete frames

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

 libavcodec/rtv1.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/rtv1.c b/libavcodec/rtv1.c
index 4b202e6a21..06afe9e873 100644
--- a/libavcodec/rtv1.c
+++ b/libavcodec/rtv1.c
@@ -54,7 +54,7 @@ static int decode_rtv1(GetByteContext *gb, uint8_t *dst, ptrdiff_t linesize,
                 int a, b;
 
                 if (bytestream2_get_bytes_left(gb) < 4)
-                    break;
+                    return AVERROR_INVALIDDATA;
 
                 a = bytestream2_get_le16u(gb);
                 b = bytestream2_get_le16u(gb);
@@ -77,7 +77,7 @@ static int decode_rtv1(GetByteContext *gb, uint8_t *dst, ptrdiff_t linesize,
                     dxt1_block(dst + x, linesize, block);
                 } else {
                     if (bytestream2_get_bytes_left(gb) < 12 * 4)
-                        break;
+                        return AVERROR_INVALIDDATA;
 
                     for (int by = 0; by < 4; by++) {
                         for (int bx = 0; bx < 4; bx++)
@@ -126,7 +126,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
     dst = p->data[0] + p->linesize[0] * (avctx->coded_height - 1);
     linesize = -p->linesize[0];
 
-    decode_rtv1(&gb, dst, linesize, width, height, flags, dsp->dxt1_block);
+    ret = decode_rtv1(&gb, dst, linesize, width, height, flags, dsp->dxt1_block);
+    if (ret < 0)
+        return ret;
 
     p->pict_type = AV_PICTURE_TYPE_I;
     p->flags |= AV_FRAME_FLAG_KEY;



More information about the ffmpeg-cvslog mailing list