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 93EBB4AAA2 for ; Thu, 11 Jul 2024 23:35:34 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 55D8B68DBC7; Fri, 12 Jul 2024 02:34:34 +0300 (EEST) Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 90C5668DB4D for ; Fri, 12 Jul 2024 02:34:28 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id CDA2540006 for ; Thu, 11 Jul 2024 23:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1720740867; 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=v2gZskAxDAlBTrRqZOboYKYO6yOn3hfYxDdwFn90vVA=; b=TVd+9VkknQb+L7GFKO6zAxIZc5A3dIFrW568/elRpMsJdUaK9IFWqqt2YM8T9vgUWfRpE7 UO/tXbZZ+0txZfdqghj2rXk1mwTwwiOaQd98XcLjOE6dy/rQIUyO5axDj+Fsby5DAS94Yd +GvhkXOhoD5iiCkyVTN6jTp1ewYkNDtGy2hESVN0c6thB8Mn5qW2vnPtKG+fi0DgtfMAaf o/fch4iKwGGBl4UUxYjDt04NSmyT2GFH3cPK1a0ByTcOG3HgSZTnyaaomTjuMHurRPXPTp PTdKjji/aOImhS1X8lJYv0liyCwRch6lrFIWVpldCTO7zws2GxdhzMlt0uxckA== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 12 Jul 2024 01:34:06 +0200 Message-ID: <20240711233417.1896879-12-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240711233417.1896879-1-michael@niedermayer.cc> References: <20240711233417.1896879-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 12/22] avformat/sauce: Check avio_size() for failure 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: CID1604592 Overflowed constant Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavformat/sauce.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavformat/sauce.c b/libavformat/sauce.c index 150be4705b5..55d288d3aea 100644 --- a/libavformat/sauce.c +++ b/libavformat/sauce.c @@ -34,7 +34,12 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g AVIOContext *pb = avctx->pb; char buf[36]; int datatype, filetype, t1, t2, nb_comments; - uint64_t start_pos = avio_size(pb) - 128; + int64_t start_pos = avio_size(pb); + + if (start_pos <= 0) + return AVERROR_INVALIDDATA; + + start_pos -= 128; avio_seek(pb, start_pos, SEEK_SET); if (avio_read(pb, buf, 7) != 7) -- 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".