[FFmpeg-cvslog] avcodec/ffv1dec: Fail earlier if prior context is corrupted

Michael Niedermayer git at videolan.org
Thu Feb 23 23:19:59 EET 2023


ffmpeg | branch: release/5.1 | Michael Niedermayer <michael at niedermayer.cc> | Thu Oct  6 22:04:48 2022 +0200| [3314bababfd34fdd92f9003d2777b93a5675ceb2] | committer: Michael Niedermayer

avcodec/ffv1dec: Fail earlier if prior context is corrupted

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 4df91e2215a79546a7f08faa457c05182646b302)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/ffv1dec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 9300297267..5660e5d940 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -303,8 +303,11 @@ static int decode_slice(AVCodecContext *c, void *arg)
     }
     if ((ret = ff_ffv1_init_slice_state(f, fs)) < 0)
         return ret;
-    if (f->cur->key_frame || fs->slice_reset_contexts)
+    if (f->cur->key_frame || fs->slice_reset_contexts) {
         ff_ffv1_clear_slice_state(f, fs);
+    } else if (fs->slice_damaged) {
+        return AVERROR_INVALIDDATA;
+    }
 
     width  = fs->slice_width;
     height = fs->slice_height;



More information about the ffmpeg-cvslog mailing list