[FFmpeg-devel] [PATCH 06/16] avcodec/asvenc: Replace bitstream space check by assert

Michael Niedermayer michael at niedermayer.cc
Mon Dec 31 20:22:36 EET 2018


This should never be untrue, if it is, thats a bug

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/asvenc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c
index c4eca2a13d..3cc94bf91a 100644
--- a/libavcodec/asvenc.c
+++ b/libavcodec/asvenc.c
@@ -173,10 +173,7 @@ static inline int encode_mb(ASV1Context *a, int16_t block[6][64])
 {
     int i;
 
-    if (a->pb.buf_end - a->pb.buf - (put_bits_count(&a->pb) >> 3) < MAX_MB_SIZE) {
-        av_log(a->avctx, AV_LOG_ERROR, "encoded frame too large\n");
-        return -1;
-    }
+    av_assert0(a->pb.buf_end - a->pb.buf - (put_bits_count(&a->pb) >> 3) >= MAX_MB_SIZE);
 
     if (a->avctx->codec_id == AV_CODEC_ID_ASV1) {
         for (i = 0; i < 6; i++)
-- 
2.20.1



More information about the ffmpeg-devel mailing list