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 02B5042AEB for ; Sun, 12 Jun 2022 17:19:13 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3A55F68B4FE; Sun, 12 Jun 2022 20:19:03 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D3CAA68B4B3 for ; Sun, 12 Jun 2022 20:18:56 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id B63E1E72B5; Sun, 12 Jun 2022 19:18:55 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JgJuH4-U8O2C; Sun, 12 Jun 2022 19:18:54 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 65DD7E6B25; Sun, 12 Jun 2022 19:18:54 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 12 Jun 2022 19:18:41 +0200 Message-Id: <20220612171845.8122-3-cus@passwd.hu> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220612171845.8122-1-cus@passwd.hu> References: <20220612171845.8122-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/7] avcodec/v210dec: disallow negative custom stride 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 Cc: Marton Balint 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: Also make sure a big custom stride does not overflow size check. Avoids segfaults. Signed-off-by: Marton Balint --- libavcodec/v210dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c index c89440658f..e97f43a8e6 100644 --- a/libavcodec/v210dec.c +++ b/libavcodec/v210dec.c @@ -141,7 +141,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *pic, stride = aligned_width * 8 / 3; } - if (avpkt->size < stride * avctx->height) { + if (avpkt->size < (int64_t)stride * avctx->height) { if ((((avctx->width + 23) / 24) * 24 * 8) / 3 * avctx->height == avpkt->size) { stride = avpkt->size / avctx->height; if (!s->stride_warning_shown) @@ -190,7 +190,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *pic, #define V210DEC_FLAGS AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM static const AVOption v210dec_options[] = { {"custom_stride", "Custom V210 stride", offsetof(V210DecContext, custom_stride), AV_OPT_TYPE_INT, - {.i64 = 0}, INT_MIN, INT_MAX, V210DEC_FLAGS}, + {.i64 = 0}, 0, INT_MAX, V210DEC_FLAGS}, {NULL} }; -- 2.34.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".