From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id D71A04A67F for ; Fri, 5 Jul 2024 00:23:46 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 134E668DAD3; Fri, 5 Jul 2024 03:22:31 +0300 (EEST) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3134968DAD1 for ; Fri, 5 Jul 2024 03:22:04 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 6C4EC240005 for ; Fri, 5 Jul 2024 00:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1720138923; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HYlIgFXivJjrpsNJ8ueFPpy6JcOktybHu8sLaEGkC0U=; b=lPWDeZnzA3lrNyCKGJmPkjRKwzUP1iyyarA/db23NmrJsYvgqdXU4kxJ93iFO//OPZA1DV CmtlURIIX9wqDhkwLqqWQEsGI0c5Gah3OLxNpYZH+Sncf2JFFydnh4xOWs+oVLQhtgBquZ 6VVQdjdPN7AnDurXWS/xdYIafKHVfUltLz6Pz/gSzs8lgAS7Sw8gkuLLqTRIsQ8VR7Isg+ Gj2TdZeQfik8baP5gsPD8vK5qjW4oiRzbnSqV6au0fGZNtMd/bIRr/QuLlELb+AbqdSW5f hmhp+VoxTqCejYGs5D2Vs4Fet0Fw++s0qbrYmKudbvgwjpTTgl/IONfynczdmw== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 5 Jul 2024 02:21:49 +0200 Message-ID: <20240705002156.1964272-8-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240705002156.1964272-1-michael@niedermayer.cc> References: <20240705002156.1964272-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 08/15] avcodec/imm4: check cbphi for error 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Fixes: CID1604356 Overflowed constant Fixes: CID1604573 Overflowed constant Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavcodec/imm4.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libavcodec/imm4.c b/libavcodec/imm4.c index 3a4ad8616f5..a6da8fcf95b 100644 --- a/libavcodec/imm4.c +++ b/libavcodec/imm4.c @@ -220,12 +220,15 @@ static int decode_intra(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame for (y = 0; y < avctx->height; y += 16) { for (x = 0; x < avctx->width; x += 16) { - unsigned flag, cbphi, cbplo; + unsigned flag, cbplo; + int cbphi; cbplo = get_vlc2(gb, cbplo_tab, CBPLO_VLC_BITS, 1); flag = get_bits1(gb); cbphi = get_cbphi(gb, 1); + if (cbphi < 0) + return cbphi; ret = decode_blocks(avctx, gb, cbplo | (cbphi << 2), 0, offset, flag); if (ret < 0) @@ -273,7 +276,8 @@ static int decode_inter(AVCodecContext *avctx, GetBitContext *gb, for (y = 0; y < avctx->height; y += 16) { for (x = 0; x < avctx->width; x += 16) { int reverse, intra_block, value; - unsigned cbphi, cbplo, flag2 = 0; + unsigned cbplo, flag2 = 0; + int cbphi; if (get_bits1(gb)) { copy_block16(frame->data[0] + y * frame->linesize[0] + x, @@ -299,6 +303,9 @@ static int decode_inter(AVCodecContext *avctx, GetBitContext *gb, cbplo = value >> 4; cbphi = get_cbphi(gb, reverse); + if (cbphi < 0) + return cbphi; + if (intra_block) { ret = decode_blocks(avctx, gb, cbplo | (cbphi << 2), 0, offset, flag2); if (ret < 0) -- 2.45.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".