From patchwork Tue Jun 1 07:33:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 28033 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:b214:0:0:0:0:0 with SMTP id b20csp3583111iof; Tue, 1 Jun 2021 00:39:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwK+6grGAmgZ4r/bsWEyIkEQECN6ldcpwf+OrhjWcpAEou4MSTU1tVsPJaU5GWvEadp8ElF X-Received: by 2002:a17:906:755:: with SMTP id z21mr26920706ejb.113.1622533182716; Tue, 01 Jun 2021 00:39:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622533182; cv=none; d=google.com; s=arc-20160816; b=CNPZJCQLI+I9A7PISD4Oe03JBhf3fHmWR033L4JEtb2+9UYEOnhm+XuJeQOBHqgC1W vN1h4DdwiCrG6iyCeRK8v9yHtDm1BsKsrpRB8oVMs2pRGhUkq9nV47P719zjf+yuvcWP lxwEVhCKk0U/p48ggyfD+/+b4yOUTmF6whDfdr74U5wbGg+G8I8DqG4RxoNwV12k4WjG 7dyf2bgrQznLTGtZUCp5059hNcW7wObnaQ2dzz0oADdvyeKthetyasw59yPwb7RE9aDd 4ig2ZMHVq96XbWf5Wb7rlWMKcWUdDCu7KM0YB2zCZW3JLyuqoaooHaU43l5/Rt4YQBEg s/UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to; bh=dVMnlPHkPI7ZA90jCgGdU4A7rHd8iRmMQzDmMS8fN0U=; b=iXe+MLzay0F6JVtFmCNFzs/zlZ/UxGY5Z486cIluxe4B1ucHIhs6ioUJczPIEIinVl ySZw5L8j1D8a/vslVY5jOiR2MBUQ9qxTS9bDbe0dHBALXjsg0PRQUmw1Fl1qFN3CjsGs qa6iVnAMoNuJH+767d8RggycxOlSkEogAFwJ5KijbY26mRysYL0jPOF3eaibUhOhzWs0 0m1BeUlEP4vhu2r/vMTlMlBrTtyFzkM4S22qKnUvQ5bAf01LmUJxKYs5XsLU1t/7AJRM ggo4Cx0X6mbLlwEAyfGFG4qBI6TBbRqCNQjJtYXc/hxy429pWFC0hQGQaddvFYFMsRBN vTmg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 3si11764778ejx.158.2021.06.01.00.39.42; Tue, 01 Jun 2021 00:39:42 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 545106801E7; Tue, 1 Jun 2021 10:39:39 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe05-2.mx.upcmail.net (vie01a-dmta-pe05-2.mx.upcmail.net [84.116.36.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E2BC26801E7 for ; Tue, 1 Jun 2021 10:39:32 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe05.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1lnyum-005H28-0G for ffmpeg-devel@ffmpeg.org; Tue, 01 Jun 2021 09:34:16 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id nytolkHjLljeHnytoloUO0; Tue, 01 Jun 2021 09:33:16 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=BoHjPrf5 c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=RFk80lJh9pQTKoE-7-QA:9 a=pHzHmUro8NiASowvMSCR:22 a=Ew2E2A-JSTLzCXPT_086:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 1 Jun 2021 09:33:15 +0200 Message-Id: <20210601073315.9104-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210601073315.9104-1-michael@niedermayer.cc> References: <20210601073315.9104-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfHrn/vzEyqFNORWLg7katG3x+A1a11ejv++u95vdi9Abyx4VkKJVSMfUJeEZhQlonR42KMa7+ihGzPU056GQgTFfaVH7KUrKeR6ishcmEeRtlIoboKTw wHa/x5mtrqp4u9AzBM3xkJZ23WxDRnIjom2ZaicnsDxj6EuKcEMK32yn Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/vc2enc: Check for non negative slice bounds X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: VUtja1/292LP Fixes: invalid shifts Fixes: Ticket 8221 Signed-off-by: Michael Niedermayer --- libavcodec/vc2enc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c index 2de6d4b17a..f0d2cdf62d 100644 --- a/libavcodec/vc2enc.c +++ b/libavcodec/vc2enc.c @@ -982,6 +982,8 @@ static av_cold int vc2_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, } s->slice_min_bytes = s->slice_max_bytes - s->slice_max_bytes*(s->tolerance/100.0f); + if (s->slice_min_bytes < 0) + return AVERROR(EINVAL); ret = encode_frame(s, avpkt, frame, aux_data, header_size, s->interlaced); if (ret)