]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/proresenc_kostya: Remove harmful check
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Wed, 7 Apr 2021 20:43:38 +0000 (22:43 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Sat, 10 Apr 2021 01:20:53 +0000 (03:20 +0200)
The ProRes encoder allocates huge worst-case buffers just to be safe;
and for huge resolutions (8k in this case) these can be so big that the
number of bits does no longer fit into a (signed 32-bit) int; this means
that one must no longer use the parts of the PutBits API that deal with
bit counters. Yet proresenc_kostya did it, namely for a check about
whether we are already beyond the end. Yet this check is unnecessary
nowadays, because the PutBits API comes with automatic checks (with
a log message and a av_assert2() in put_bits() and an av_assert0() in
flush_put_bits()), so this is unnecessary. So simply remove the check.

Fixes ticket #9173.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
libavcodec/proresenc_kostya.c

index d8edd12f3418046bfdf0a9fb5c75511a1714f195..54fc6707a18f2c9dd2da1b8720c37f9fba9f0649 100644 (file)
@@ -619,11 +619,6 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic,
         flush_put_bits(pb);
         sizes[i]   = put_bytes_output(pb) - total_size;
         total_size = put_bytes_output(pb);
-        if (put_bits_left(pb) < 0) {
-            av_log(avctx, AV_LOG_ERROR,
-                   "Underestimated required buffer size.\n");
-            return AVERROR_BUG;
-        }
     }
     return total_size;
 }