From patchwork Wed Oct 17 00:18:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Zhao X-Patchwork-Id: 10692 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 AFFA0446E4C for ; Wed, 17 Oct 2018 03:24:39 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 156AF68A57D; Wed, 17 Oct 2018 03:24:21 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1A044689AAA for ; Wed, 17 Oct 2018 03:24:14 +0300 (EEST) Received: by mail-pl1-f194.google.com with SMTP id u6-v6so9050612plz.4 for ; Tue, 16 Oct 2018 17:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Q5MQUxvCTzN9/lswOh8exn2t7sagh9DO0y4emevd2Z4=; b=NDFeWaTonrIpPT954se219GNQluQXNZdkvWH9vQX663beF2bZRs33V0xWp7Z629yQc LwRzrTJCduBe5sDhyeRQ0AyJRD73veCyrmVjgTtR4/8qsTXL6RtQoaHKneTQz5tRbMhH IXQIg9f6EnoSQoPS1nSN85GRcV6J6lYnuvtbS3qGeEy7GiOsWWLtQBk+zqUwF9uTkPXn G+sxTNGZYoUgXONbrMV6NbGH3jqF+Sl6n8xUW3ZawRYwZK9Mkyf0Nw6ZJatylITGyy+N 8I1GkN7Vps9Sz20Q3aPw0i2hFfAQeoTH9nrh+tjVRSH46rlECvlq+VycXU1HxcGjjxPA DSWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Q5MQUxvCTzN9/lswOh8exn2t7sagh9DO0y4emevd2Z4=; b=oXxJVYBONUyVJAgpi7G25AiHutPiRp5DWHzNVWhWZobMy+VT3UES8+p+oxatCcjQC1 WJOYSQbqSWM4Lkc1jtQrCxb3cUZBLko+LKqdU71nDOPgpKUdcIIQ2RO6O++ISxNXuJNC YDP0rEnQvZB2e7sh5QF3HQ9w9TDmCwQAbyMSvZvaZBOqq2MqV2kwOwf1rUQtSATbLRuR S/A9zLPTs7mPp9/0jmhDaW6GQiKcjWq+MsuzmPs/LFdBxMYOvDjLZB+7XN/RLiEpgBP6 r6Jg22gYi+N1sft2RwsCuBaEhhn9anZvKA8Kn180sYE4Yh/soMiV92bo3MbiW1uWzHA6 xi/w== X-Gm-Message-State: ABuFfohJ7ajfgqRFklXMLKf53XSl2BMdVtiCOJ9Mc5D/xzN6dtXWZ8zP iLe95C0UNkhrReG9qeX8lCCDN/6/ X-Google-Smtp-Source: ACcGV60f/WfnCWFDQYBfJuhxSRViE5M4bOPX0+InfUSMsQg5CFeHSB8VGQvcPqGVeuMzrwIJjxocLw== X-Received: by 2002:a17:902:7c11:: with SMTP id x17-v6mr22555722pll.1.1539735548659; Tue, 16 Oct 2018 17:19:08 -0700 (PDT) Received: from localhost.localdomain ([47.90.47.25]) by smtp.gmail.com with ESMTPSA id 64-v6sm20116953pgb.74.2018.10.16.17.19.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Oct 2018 17:19:07 -0700 (PDT) From: Jun Zhao To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 Oct 2018 08:18:57 +0800 Message-Id: <1539735538-15714-2-git-send-email-mypopydev@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: References: Subject: [FFmpeg-devel] [PATCH V5 1/2] lavf/vc1test: fix vc1test can't probe some RCV file. 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: "Yan, FengX" , Jun Zhao , Jun Zhao MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" case 1: use the hexdump -C SMM0005.rcv get: size skip (size - 4) | | V V 00000000 18 00 00 c5 05 00 00 00 4d f1 0a 11 00 e0 01 00 00000010 00 d0 02 00 00 0c 00 00 00 88 13 00 00 c0 65 52 ^ | size + 16 case 2: same the command for SMM0015.rcv get: size | V 00000000 19 00 00 c5 04 00 00 00 41 f3 80 01 40 02 00 00 00000010 d0 02 00 00 0c 00 00 00 00 00 00 10 00 00 00 00 ^ | size + 16 There are different the RCV file format for VC-1, vc1test just handle the case 2 now, this fix will support the case 1. (Both of test clips come from: SMPTE Recommended Practice - VC-1 Decoder and Bitstream Conformance). And I think I got a older VC-1 test clip in the case 1. Reviewed-by: Carl Eugen Hoyos Reviewed-by: Jerome Borsboom Reviewed-by: Michael Niedermayer Signed-off-by: Jun Zhao Signed-off-by: Yan, FengX --- libavformat/vc1test.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c index a801f4b..64a45cd 100644 --- a/libavformat/vc1test.c +++ b/libavformat/vc1test.c @@ -34,9 +34,14 @@ static int vc1t_probe(AVProbeData *p) { + uint32_t size; + if (p->buf_size < 24) return 0; - if (p->buf[3] != 0xC5 || AV_RL32(&p->buf[4]) != 4 || AV_RL32(&p->buf[20]) != 0xC) + + size = AV_RL32(&p->buf[4]); + if (p->buf[3] != 0xC5 || size < 4 || size > p->buf_size - 20 || + AV_RL32(&p->buf[size+16]) != 0xC) return 0; return AVPROBE_SCORE_EXTENSION; @@ -48,9 +53,10 @@ static int vc1t_read_header(AVFormatContext *s) AVStream *st; int frames; uint32_t fps; + uint32_t size; frames = avio_rl24(pb); - if(avio_r8(pb) != 0xC5 || avio_rl32(pb) != 4) + if (avio_r8(pb) != 0xC5 || ((size = avio_rl32(pb)) < 4)) return AVERROR_INVALIDDATA; /* init video codec */ @@ -63,6 +69,8 @@ static int vc1t_read_header(AVFormatContext *s) if (ff_get_extradata(s, st->codecpar, pb, VC1_EXTRADATA_SIZE) < 0) return AVERROR(ENOMEM); + + avio_skip(pb, size - 4); st->codecpar->height = avio_rl32(pb); st->codecpar->width = avio_rl32(pb); if(avio_rl32(pb) != 0xC)