From patchwork Fri Oct 2 22:23:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Gaullier X-Patchwork-Id: 22710 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 553CC44BDEC for ; Sat, 3 Oct 2020 01:24:08 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 46E9E68A98A; Sat, 3 Oct 2020 01:24:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from srv-infra-1.infra.inf.glb.tvvideoms.com (unknown [213.205.126.156]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 15B2868A800 for ; Sat, 3 Oct 2020 01:24:01 +0300 (EEST) Received: from cji.paris (unknown [172.16.3.159]) by srv-infra-1.infra.inf.glb.tvvideoms.com (Postfix) with ESMTP id 0B07B20205; Fri, 2 Oct 2020 22:23:57 +0000 (UTC) From: Nicolas Gaullier To: ffmpeg-devel@ffmpeg.org Date: Sat, 3 Oct 2020 00:23:44 +0200 Message-Id: <20201002222346.1196-8-nicolas.gaullier@cji.paris> X-Mailer: git-send-email 2.27.0.windows.1 In-Reply-To: <20201002222346.1196-1-nicolas.gaullier@cji.paris> References: <20201002222346.1196-1-nicolas.gaullier@cji.paris> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 7/9] avformat/wavdec: fix s337m/spdif probing beyond data_end X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Nicolas Gaullier Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavformat/wavdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c index 5b287680e2..9f48ff067b 100644 --- a/libavformat/wavdec.c +++ b/libavformat/wavdec.c @@ -80,7 +80,7 @@ static void set_spdif_s337m(AVFormatContext *s, WAVDemuxContext *wav) ret = AVERROR(ENOMEM); } else { int64_t pos = avio_tell(s->pb); - len = ret = avio_read(s->pb, buf, len); + len = ret = avio_read(s->pb, buf, FFMIN(len, wav->data_end - pos)); if (len >= 0) { if (CONFIG_SPDIF_DEMUXER) { ret = ff_spdif_probe(buf, len, &codec);