From patchwork Fri Jun 12 11:46:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zane van Iperen X-Patchwork-Id: 20306 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 209EF44AEBB for ; Fri, 12 Jun 2020 14:46:28 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EEFBB68B640; Fri, 12 Jun 2020 14:46:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail2.protonmail.ch (mail2.protonmail.ch [185.70.40.22]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9E4BB68AB96 for ; Fri, 12 Jun 2020 14:46:20 +0300 (EEST) Date: Fri, 12 Jun 2020 11:46:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zanevaniperen.com; s=protonmail; t=1591962379; bh=nfpMFYAiOpOBMmLvbu6REs523PHw10pwn5XP9vAeDA0=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=Q5GpCC0nqP9F6OtVwWzh2cAViiysXftNrFVWyQUd1RcI/RUaFBBxQ5vGCoGWbE+VS cSZOhl05Utm5lpJsy+QjnIwIrFFq0wkb0QcMvi2rnFi+fMfWJg7YfdkZY7SELAVJJG 2QerEkBEl35dHWF33H3W68Klh1TVVc8yh1f/gcBI= To: ffmpeg-devel@ffmpeg.org From: Zane van Iperen Message-ID: <20200612114603.1157417-2-zane@zanevaniperen.com> In-Reply-To: <20200612114603.1157417-1-zane@zanevaniperen.com> References: <20200612114603.1157417-1-zane@zanevaniperen.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=7.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mail.protonmail.ch Subject: [FFmpeg-devel] [PATCH v3 1/7] avformat/apm: check codec tag in probe and add constant 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: Zane van Iperen Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Zane van Iperen --- libavformat/apm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/apm.c b/libavformat/apm.c index 9d2a856cc4..dc59c16562 100644 --- a/libavformat/apm.c +++ b/libavformat/apm.c @@ -29,6 +29,7 @@ #define APM_VS12_CHUNK_SIZE 76 #define APM_MAX_READ_SIZE 4096 +#define APM_TAG_CODEC 0x2000 #define APM_TAG_VS12 MKTAG('v', 's', '1', '2') #define APM_TAG_DATA MKTAG('D', 'A', 'T', 'A') @@ -74,6 +75,9 @@ static void apm_parse_vs12(APMVS12Chunk *vs12, const uint8_t *buf) static int apm_probe(const AVProbeData *p) { + if (AV_RL16(p->buf) != APM_TAG_CODEC) + return 0; + if (p->buf_size < 100) return 0; @@ -103,7 +107,7 @@ static int apm_read_header(AVFormatContext *s) if (st->codecpar->bits_per_coded_sample != 4) return AVERROR_INVALIDDATA; - if (st->codecpar->codec_tag != 0x2000) + if (st->codecpar->codec_tag != APM_TAG_CODEC) return AVERROR_INVALIDDATA; /* ff_get_wav_header() does most of the work, but we need to fix a few things. */