]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/lagarith.c
avcodec/lagarith: check and propagate return value from init_get_bits8()
[ffmpeg] / libavcodec / lagarith.c
index 710558cbef0cc35d92695a69c1159aa990bbb179..11d7791bfa41b7d76a07a723c125890296c9a770 100644 (file)
@@ -370,7 +370,8 @@ static int lag_decode_zero_run_line(LagarithContext *l, uint8_t *dst,
     uint8_t *end = dst + (width - 2);
 
     avpriv_request_sample(l->avctx, "zero_run_line");
-    return AVERROR_PATCHWELCOME;
+
+    memset(dst, 0, width);
 
 output_zeros:
     if (l->zeros_rem) {
@@ -426,6 +427,7 @@ static int lag_decode_arith_plane(LagarithContext *l, uint8_t *dst,
     GetBitContext gb;
     lag_rac rac;
     const uint8_t *src_end = src + src_size;
+    int ret;
 
     rac.avctx = l->avctx;
     l->zeros = 0;
@@ -443,7 +445,8 @@ static int lag_decode_arith_plane(LagarithContext *l, uint8_t *dst,
             offset += 4;
         }
 
-        init_get_bits(&gb, src + offset, (src_size - offset) * 8);
+        if ((ret = init_get_bits8(&gb, src + offset, src_size - offset)) < 0)
+            return ret;
 
         if (lag_read_prob_header(&rac, &gb) < 0)
             return -1;