[FFmpeg-devel] [PATCH 2/2] avcodec/ffv1dec: Use ff_rac_check_termination()

Michael Niedermayer michael at niedermayer.cc
Sun Dec 23 20:24:50 EET 2018


Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/ffv1dec.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 261e0cf70c..e37deaec33 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -311,7 +311,10 @@ static int decode_slice(AVCodecContext *c, void *arg)
 
     if (fs->ac == AC_GOLOMB_RICE) {
         if (f->version == 3 && f->micro_version > 1 || f->version > 3)
-            get_rac(&fs->c, (uint8_t[]) { 129 });
+            if (ff_rac_check_termination(&fs->c, 1) < 0) {
+                av_log(f->avctx, AV_LOG_ERROR, "bytestream termination mismatching\n");
+                fs->slice_damaged = 1;
+            }
         fs->ac_byte_count = f->version > 2 || (!x && !y) ? fs->c.bytestream - fs->c.bytestream_start - 1 : 0;
         init_get_bits(&fs->gb,
                       fs->c.bytestream_start + fs->ac_byte_count,
@@ -350,7 +353,10 @@ static int decode_slice(AVCodecContext *c, void *arg)
     }
     if (fs->ac != AC_GOLOMB_RICE && f->version > 2) {
         int v;
-        get_rac(&fs->c, (uint8_t[]) { 129 });
+        if (ff_rac_check_termination(&fs->c, 1) < 0) {
+            av_log(f->avctx, AV_LOG_ERROR, "bytestream termination mismatching\n");
+            fs->slice_damaged = 1;
+        }
         v = fs->c.bytestream_end - fs->c.bytestream - 2 - 5*f->ec;
         if (v) {
             av_log(f->avctx, AV_LOG_ERROR, "bytestream end mismatching by %d\n", v);
-- 
2.20.1



More information about the ffmpeg-devel mailing list