[FFmpeg-devel] [PATCH 2/4] avcodec/ffv1dec: Fail earlier if prior context is corrupted

Michael Niedermayer michael at niedermayer.cc
Thu Oct 6 23:37:07 EEST 2022


Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/ffv1dec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index d4bc60a7da8..958b3cd3c05 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;
-- 
2.17.1



More information about the ffmpeg-devel mailing list