From patchwork Mon Dec 31 18:22:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 11601 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2F59944D239 for ; Mon, 31 Dec 2018 20:23:58 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E800F68A6AF; Mon, 31 Dec 2018 20:23:54 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-3.mx.upcmail.net (vie01a-qmta-pe01-3.mx.upcmail.net [62.179.121.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A85D068A357 for ; Mon, 31 Dec 2018 20:23:52 +0200 (EET) Received: from [172.31.218.54] (helo=vie01a-dmta-pe08-3.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1ge2EK-0007NV-9J for ffmpeg-devel@ffmpeg.org; Mon, 31 Dec 2018 19:24:00 +0100 Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe08.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1ge2EF-0006Bv-0X for ffmpeg-devel@ffmpeg.org; Mon, 31 Dec 2018 19:23:55 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id e2DFget2v2WSse2DGg1Ou0; Mon, 31 Dec 2018 19:22:54 +0100 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.41.20 X-CNFS-Analysis: v=2.3 cv=E7kcWpVl c=1 sm=1 tr=0 a=I1eytVlZLDX1BM2VTtTtSw==:117 a=I1eytVlZLDX1BM2VTtTtSw==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=3GLR1-XzZKwA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=bCJLmrIqcu0g3idB9wsA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 31 Dec 2018 19:22:36 +0100 Message-Id: <20181231182246.14327-6-michael@niedermayer.cc> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20181231182246.14327-1-michael@niedermayer.cc> References: <20181231182246.14327-1-michael@niedermayer.cc> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfOpWqFQgad3xLA6q3Td5Ga7OjujWng9D5mO+3G0iToN8j933OHKJZ4RVy3gXUjeRrMyGZREVIlHr+KtfiG/2WHaqsexaLkgrsjnAbuJWXeDhMrSbuBaB R0RKh5cJCHqrJtVuw+npFlq9LdauXosySK0QOfUcjAeqmEMuvsUNPWjs Subject: [FFmpeg-devel] [PATCH 06/16] avcodec/asvenc: Replace bitstream space check by assert X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This should never be untrue, if it is, thats a bug Signed-off-by: Michael Niedermayer --- 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++)