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 55AD745919 for ; Wed, 26 Jul 2023 23:59:27 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BC55068C830; Thu, 27 Jul 2023 02:59:24 +0300 (EEST) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8301B68C64B for ; Thu, 27 Jul 2023 02:59:18 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id A166320003 for ; Wed, 26 Jul 2023 23:59:17 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 27 Jul 2023 01:59:13 +0200 Message-Id: <20230726235916.30058-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 1/4] avcodec/rtv1: Check if the minimal size is available in decode_rtv1() 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 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: Signed-off-by: Michael Niedermayer --- libavcodec/rtv1.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/rtv1.c b/libavcodec/rtv1.c index 4b202e6a21..95fa9210d8 100644 --- a/libavcodec/rtv1.c +++ b/libavcodec/rtv1.c @@ -44,6 +44,8 @@ static int decode_rtv1(GetByteContext *gb, uint8_t *dst, ptrdiff_t linesize, uint8_t block[8] = { 0 }; int run = 0; + if (bytestream2_get_bytes_left(gb) < (width / 4) * (height / 4) / 0xFFFF * 4) + return AVERROR_INVALIDDATA; for (int y = 0; y < height; y += 4) { for (int x = 0; x < width * 4; x += 16) { int mode = 0; @@ -126,7 +128,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, dst = p->data[0] + p->linesize[0] * (avctx->coded_height - 1); linesize = -p->linesize[0]; - decode_rtv1(&gb, dst, linesize, width, height, flags, dsp->dxt1_block); + ret = decode_rtv1(&gb, dst, linesize, width, height, flags, dsp->dxt1_block); + if (ret < 0) + return ret; p->pict_type = AV_PICTURE_TYPE_I; p->flags |= AV_FRAME_FLAG_KEY; -- 2.17.1 _______________________________________________ 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".