From patchwork Sat Jan 26 14:26:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 11866 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 5D9B544D6AF for ; Sat, 26 Jan 2019 16:26:06 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 793B268AE3C; Sat, 26 Jan 2019 16:25:54 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2677668AC83 for ; Sat, 26 Jan 2019 16:25:48 +0200 (EET) Received: by mail-io1-f65.google.com with SMTP id f4so10023486ion.2 for ; Sat, 26 Jan 2019 06:26:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=2Ti3oghIcLLLkHMY5GG9W9g6rcaQk2TNrx7QY/2nj+I=; b=bVOXEhhA4vcHpK4NYsGcrEsb4G/mLWmrXq24uhOtoHFmyFl7ZwXz7i5oa1swbezscz qfCoJ69Y8vKeFDgT1sbQLzZVaK8Dxa0vDFsagcGDEHZzJXXKU5TxYLxNzVW6wze0yUZ+ CU1uB9r/0YqVrWafkR6V9QYH71qnvAt+Wf9CnSznYW0P5uJJ9X6ZuCr3A0B9tB22aFgZ F8TOfnA6w0DQ4U0XYZqxlllVfUsPFb9y0fe6uzQajhDId01znYZYJODytrPEnN7nR48E rhVeHEAH6KsLT2uJtF2arGdXkUB5plO6DShdX3w/BrKoQH47/+a8k3tMwzfgOMppQ+Kt R3/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=2Ti3oghIcLLLkHMY5GG9W9g6rcaQk2TNrx7QY/2nj+I=; b=nY5sZVdKNvbS45+z9gtJgzQMrNpr1T8onzaZiIvTnjn2+Do2ZB/B/jBXjuglbS6ZTo WW2WPFdJQH/wLyuzmsvTxdMi+9aPYdE1iXKUnXFMppnQ7/09omsXEbuUjab9bpiOCIAX W78BQ0vspW4Y62MNI6J65ofD3p8JWbR6V6zEfGzjB2g651XKCFsu31Oi3mLpbNrszuVc HIy2+EAia3PCEDe/yYV5Yom6R3bhEOqqLwPzISPuVhSyJKHUZghYOqHK1FLaBIS1+xX5 Xn108bqq9pYccVqPd11ABLsytPpT2c80DusNcpBS4KCR3Dc2h38pH9JGAzoYPJOtihS9 sCag== X-Gm-Message-State: AHQUAuYSMz5J/J4aWyaMWjR+OICp0yfOmGwgpboFNSm4nRFttJKLQiqm zxC3H5lYgbyVeJLtLNV1sR1tWd/Z0C1qv5On1z/ZfQ== X-Google-Smtp-Source: ALg8bN4X5vWRD/zGTpMMqtZ9twfFsS6G58lBkFHrBFRLeKGDMimIU1tb/+HmT0oC3lhHYNbcgCMjl1njBz4qOhQu8U4= X-Received: by 2002:a6b:6504:: with SMTP id z4mr9725188iob.55.1548512765948; Sat, 26 Jan 2019 06:26:05 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a02:5f11:0:0:0:0:0 with HTTP; Sat, 26 Jan 2019 06:26:05 -0800 (PST) In-Reply-To: References: From: Carl Eugen Hoyos Date: Sat, 26 Jan 2019 15:26:05 +0100 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH]lavf/cafdec: Do not fail for unknown atoms with negative size. 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 2019-01-25 17:49 GMT+01:00, Paul B Mahol : > On 1/23/19, Carl Eugen Hoyos wrote: >> Hi! >> >> Attached patch allows to read a user's file that plays fine with QT. >> The patch duplicates the behaviour of QT. >> >> Please comment, Carl Eugen > > lgtm Sorry, I had attached the wrong patch. New patch attached, Carl Eugen From 67d49072d60b95ffc8838a20cb87b33b5904dc21 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Tue, 15 Jan 2019 00:22:50 +0100 Subject: [PATCH] lavf/cafdec: Do not fail for unknown atoms with negative size. The specification requires the demuxer to only read the data atom up to its given size, this is necessary as atoms are allowed at the end of the file. This patch duplicates the behaviour of the QuickTime player. --- libavformat/cafdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index 7652d9e..20956bc 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -310,6 +310,8 @@ static int read_header(AVFormatContext *s) "skipping CAF chunk: %08"PRIX32" (%s), size %"PRId64"\n", tag, av_fourcc2str(av_bswap32(tag)), size); case MKBETAG('f','r','e','e'): + if (size < 0 && found_data) + goto found_data; if (size < 0) return AVERROR_INVALIDDATA; break; @@ -325,6 +327,7 @@ static int read_header(AVFormatContext *s) if (!found_data) return AVERROR_INVALIDDATA; +found_data: if (caf->bytes_per_packet > 0 && caf->frames_per_packet > 0) { if (caf->data_size > 0) st->nb_frames = (caf->data_size / caf->bytes_per_packet) * caf->frames_per_packet; -- 1.7.10.4