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 3DF3B4657E for ; Thu, 22 Jun 2023 00:30:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4576868BF63; Thu, 22 Jun 2023 03:30:47 +0300 (EEST) Received: from mail-01-1.mymagenta.at (mail-01-1.mymagenta.at [80.109.253.246]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7250768C06F for ; Thu, 22 Jun 2023 03:30:40 +0300 (EEST) Received: from [192.168.232.136] (helo=ren-mail-psmtp-mg02.) by mail-01.mymagenta.at with esmtp (Exim 4.93) (envelope-from ) id 1qC8De-00397b-KF for ffmpeg-devel@ffmpeg.org; Thu, 22 Jun 2023 02:30:38 +0200 Received: from localhost ([84.115.40.24]) by ren-mail-psmtp-mg02. with ESMTP id C8DgqGqO4bZLDC8DgqvdMC; Thu, 22 Jun 2023 02:30:40 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 84.115.40.24 X-CNFS-Analysis: v=2.4 cv=Ufwy9IeN c=1 sm=1 tr=0 ts=64939630 a=4thelYDX6rwh+ygQwvsI+Q==:117 a=4thelYDX6rwh+ygQwvsI+Q==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=0F0uvNKHqajQILr-oW4A:9 a=zZCYzV9kfG8A:10 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 22 Jun 2023 02:30:38 +0200 Message-Id: <20230622003038.20969-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4xfIK6TJan8vuu3dAm9/2Q0YEzkoEqpdekL9nWoPLQWQ6WTc2Dmk6qorIVjO0r8fVhGQ9gDyAA+okbDJv1izJzs7LiTl3mVJI3p58p+gqug9r905eVo4A4 YRt0JJYBV2vXg6rDaexHNnW7BbYZDwDPAG4ElvvEdgGZJSmQc+psrm5unYRyW7y66VGkGtPh7MZ2uA== Subject: [FFmpeg-devel] [PATCH] avcodec/parser: Check next against buffer index 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: Fixes: out of array access Fixes: crash-0d640731c7da52415670eb47a2af701cbe2e1a3b Found-by: Catena cyber Signed-off-by: Michael Niedermayer --- libavcodec/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/parser.c b/libavcodec/parser.c index efc28b8918..db39e698ab 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -214,7 +214,7 @@ int ff_combine_frame(ParseContext *pc, int next, for (; pc->overread > 0; pc->overread--) pc->buffer[pc->index++] = pc->buffer[pc->overread_index++]; - if (next > *buf_size) + if (next > *buf_size || (next < -pc->index && next != END_NOT_FOUND)) return AVERROR(EINVAL); /* flush remaining if EOF */ -- 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".