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

Submitted by Michael Niedermayer on Dec. 23, 2018, 6:24 p.m.

Details

Message ID 20181223182450.26476-2-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer Dec. 23, 2018, 6:24 p.m.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/ffv1dec.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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);