]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dirac_arith.h
avcodec/diracdec: Propagate errors from dirac_get_arith_uint()
[ffmpeg] / libavcodec / dirac_arith.h
index 24a7ca390e704bec11e8f45435ff95b370f809b2..efe30b79debb76adf41636c0bc67eac9187c3c4f 100644 (file)
@@ -81,6 +81,7 @@ typedef struct {
     const uint8_t *bytestream_end;
 
     uint16_t contexts[DIRAC_CTX_COUNT];
+    int error;
 } DiracArith;
 
 extern const uint8_t ff_dirac_next_ctx[DIRAC_CTX_COUNT];
@@ -173,6 +174,7 @@ static inline int dirac_get_arith_uint(DiracArith *c, int follow_ctx, int data_c
     while (!dirac_get_arith_bit(c, follow_ctx)) {
         if (ret >= 0x40000000) {
             av_log(NULL, AV_LOG_ERROR, "dirac_get_arith_uint overflow\n");
+            c->error = AVERROR_INVALIDDATA;
             return -1;
         }
         ret <<= 1;