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 C9D25492C0 for ; Wed, 8 May 2024 02:39:44 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0CB0968D511; Wed, 8 May 2024 05:39:35 +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 65A3268CA42 for ; Wed, 8 May 2024 05:39:26 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 91B3820002 for ; Wed, 8 May 2024 02:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1715135965; 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=snd9ZKuVpFm5tZo+yit5Qz9IuYQWRBvDRNQuj3pxcZ8=; b=kMn+Q5bbbZA+Feaz0iP06RXlYjqQ8HavxZzcMGSsmpbJgrP3CsmAn0T5jPxtmzUXCZx56s QQ/yg2S0Wg1oNewQk0R3H2bU84DWoJFu6F3O/7wvq+OfAoYh70wjk8Z22YRr+FYFQADIsj j4kTDZkKkEMrorRH63jigygf0KuSbTfdrA/l6oOSykH0bujYG/Caua1yiHlIfPgMpZmNpC jXRRNdne/v+qR71UslL6POVb5xNxCiabiWQMNGPp2IjQD3nI0QcUwj/yT/eZEjldFQS7m9 TBNHh+Bj5MWovaJ/l/xjQR2QLsyoHhAGT+jxDESzlfZ/cmfMyB/Vomwa/eZLLw== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 8 May 2024 04:39:22 +0200 Message-ID: <20240508023923.28209-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240508023923.28209-1-michael@niedermayer.cc> References: <20240508023923.28209-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/3] avformat/sdp: Check before appending ", " 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: Found by reviewing code related to CID1500301 String not null terminated Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavformat/sdp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/sdp.c b/libavformat/sdp.c index 7e11a759185..ccfaa8aff58 100644 --- a/libavformat/sdp.c +++ b/libavformat/sdp.c @@ -203,6 +203,8 @@ static int extradata2psets(AVFormatContext *s, const AVCodecParameters *par, continue; } if (p != (psets + strlen(pset_string))) { + if (p - psets >= MAX_PSET_SIZE) + goto fail_in_loop; *p = ','; p++; } @@ -213,6 +215,7 @@ static int extradata2psets(AVFormatContext *s, const AVCodecParameters *par, if (!av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r)) { av_log(s, AV_LOG_ERROR, "Cannot Base64-encode %"PTRDIFF_SPECIFIER" %"PTRDIFF_SPECIFIER"!\n", MAX_PSET_SIZE - (p - psets), r1 - r); +fail_in_loop: av_free(psets); av_free(tmpbuf); -- 2.43.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".