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 B12EB4346F for ; Sun, 11 Dec 2022 20:34:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6BC9968BDDF; Sun, 11 Dec 2022 22:34:22 +0200 (EET) Received: from mail-ua1-f49.google.com (mail-ua1-f49.google.com [209.85.222.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DDD5468B720 for ; Sun, 11 Dec 2022 22:34:15 +0200 (EET) Received: by mail-ua1-f49.google.com with SMTP id n21so2665023uaj.8 for ; Sun, 11 Dec 2022 12:34:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resi.io; s=google; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=oFFEZ8hOTf29ZX9T+eoj9HbvJHfujwYf5r77B5wIyKU=; b=GpwrI1JJDSdOCd26O9CJf0Xls4DUdkiQqfH1IWxZaB39EqMkLzUcenTrkpQ5+70AMq Yna+2nvviPacdSOte/e4oqPOnL/zaQXGzpsV+Q80vnGP5CuxvcH99KLoRhWPnvOJEyMc B4CHBQWHHPRm0zB9dECv3UEDP/2rpWqdMnXIZI/2qT4rxgBaoGCiKNPYQodDg04Nwako JDE032LmpT++yckfvtIGdlMn9m/xVZEIlFN9I3RVRPvDV44iZEW7mh5nMYvgReHIVz/k 4wfOGt0IVfIrY7eCfSQTQy4Pglqrf4GNbj5T3gsSwWP2DJmgg+7hDn6ysB8gMjc7XZ+x R6bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oFFEZ8hOTf29ZX9T+eoj9HbvJHfujwYf5r77B5wIyKU=; b=xxM1oPSd5KjMsvjMBg2VBAC4/CuWOLr4MRbMS+JkOyyp/qXGzKVlXIHpdd1afDEMyP 5dfGIL6QGQb2cCYTkw2kqJSwPmqO8BiLg8dFg35aBbmOgg20AGXs4bv1jHqawVdlltrh uXNM/Mtn6pyS/JTJQfEZfurDU+9FdI0lrLyLOH7184+fjaGGOGkU1L47dp4pyAiU4npR 6ieUF8E4MYHI9Bu7BAfoAt6va2XyVhoh9f26CPCL7UrnsZ1Ko6Pi0VGddHbJca/2RzUF P5+UsA9eHhmvMCm6kalt/yYFV+kkBSWs+v+mZ0gjpn1OifzF9A2FKc/GVs4NuhuT1NR4 P2zQ== X-Gm-Message-State: ANoB5pnki7SuSZn/UGlnauuxkoI2sK0SIj7J4bOZ8pgTXq1ICgSOE8f8 9EXOZLqM9GdCLRJXYL5GKFBEsBSr+8HELLr8JaRofFMzrCtcBBB/ X-Google-Smtp-Source: AA0mqf6B0MavF2kH+8nGlQ7i78E1ROM4arMeTT7KsIrH5CRQ2LA2C0gYcXi01up3kqW+Syhuzov924dInOW+2CGIlqU= X-Received: by 2002:ab0:6287:0:b0:418:e278:124a with SMTP id z7-20020ab06287000000b00418e278124amr41367614uao.9.1670790853855; Sun, 11 Dec 2022 12:34:13 -0800 (PST) MIME-Version: 1.0 References: <20221204235002.26754-2-cus@passwd.hu> <20221211115440.9942-1-cus@passwd.hu> In-Reply-To: <20221211115440.9942-1-cus@passwd.hu> From: Chris Ribble Date: Sun, 11 Dec 2022 14:34:03 -0600 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH v2 2/2] avformat/mov: re-allow zero sample sizes if that is not the default 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: On Sun, Dec 11, 2022 at 5:55 AM Marton Balint wrote: > > Patch 03d81a044ad587ea83567f75dc36bc3d64278199 disallowed zero sample sizes, > but there are some files in the wild which have zero sized samples (e.g. > no audio in some part of a live recording). > > Fix this by simply ignoring a trun box with zero sized samples. This approach > fixes the original timeout issue from fuzzed files differently. > > Signed-off-by: Marton Balint > --- > libavformat/mov.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/libavformat/mov.c b/libavformat/mov.c > index 935b2f8d9f..63e0b614df 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -5121,6 +5121,11 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) > if (flags & MOV_TRUN_DATA_OFFSET) data_offset = avio_rb32(pb); > if (flags & MOV_TRUN_FIRST_SAMPLE_FLAGS) first_sample_flags = avio_rb32(pb); > > + if (entries && !frag->size && !(flags & MOV_TRUN_SAMPLE_SIZE)) { > + av_log(c->fc, AV_LOG_WARNING, "Ignoring trun box with zero sized samples\n"); > + entries = 0; > + } > + > frag_stream_info = get_current_frag_stream_info(&c->frag_index); > if (frag_stream_info) { > if (frag_stream_info->next_trun_dts != AV_NOPTS_VALUE) { > @@ -5293,8 +5298,6 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) > distance++; > if (av_sat_add64(dts, sample_duration) != dts + (uint64_t)sample_duration) > return AVERROR_INVALIDDATA; > - if (!sample_size) > - return AVERROR_INVALIDDATA; > dts += sample_duration; > offset += sample_size; > sc->data_size += sample_size; > -- > 2.35.3 Marton, This looks great and I've confirmed it fixes the issue. I see the warning on STDERR about ignoring the trun box: "Ignoring trun box with zero sized samples", which is great. Thanks for doing this! Assuming this is applied to master, would it also be reasonable to apply it to the 5.1 branch? -Chris _______________________________________________ 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".