Message ID | 08deadd4-2dc6-27c3-d6f5-af6a85ca622c@googlemail.com |
---|---|
State | Superseded |
Headers |
Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.133 with SMTP id o127csp834716vsd; Tue, 18 Oct 2016 13:31:48 -0700 (PDT) X-Received: by 10.194.201.36 with SMTP id jx4mr1606258wjc.38.1476822708773; Tue, 18 Oct 2016 13:31:48 -0700 (PDT) Return-Path: <ffmpeg-devel-bounces@ffmpeg.org> Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id x7si1164842wmg.40.2016.10.18.13.31.47; Tue, 18 Oct 2016 13:31:48 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@googlemail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE dis=NONE) header.from=googlemail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8A57368973A; Tue, 18 Oct 2016 23:31:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0DB6768920D for <ffmpeg-devel@ffmpeg.org>; Tue, 18 Oct 2016 23:31:37 +0300 (EEST) Received: by mail-wm0-f65.google.com with SMTP id g16so1059954wmg.2 for <ffmpeg-devel@ffmpeg.org>; Tue, 18 Oct 2016 13:31:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=1kCcl9iVj7/XxNgBy9imi5vXE7NykNBJxNi360u2bzU=; b=HFqEXlTWJXS8nhxwmzDxnpToQr5HCSLS5Nuwlr1rgGEOit24lj6qPzR2QVu1OGg/Ls iZWTQivgUxKTIPmNlHUI6zDjq+7Wjy5WEm3E+2JwGSWp0UUJ8Tbu9VPgF/SOqht1WNRC xNdtvgjgZTZVGpw7kdtaBI2zw0L/7tgKUyC79PPkDwm/3CRe/51cV+xNg0qH/VZRm8jJ mL++QdAgvYn7ZA1z4VGzcLGF6Y15wU9IHLx1uUe0IDm20fowngAwQWFYa6kQ19FIVse8 EPTgmzfXG3lEtx1PjscQqttXFTLJOJPH7AQ/hyn2k2CUEGU+4ZCmyrdF/Toz8HNybP/X jCiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=1kCcl9iVj7/XxNgBy9imi5vXE7NykNBJxNi360u2bzU=; b=Pzg0wAUJHEXb9ae3lD43PkCunN9XrEFcZwDZTKulzvBAiEAbK9/NYz+Sj3Z6eXENpU lpDKtYGAeAqtFfHIQAo3rcTTJKVuvW1rb/Q/3967+otALHmLn9FslSHu7txCZYYWhs87 JPE6AmIaZZSQCJQ0pRTC+aftIXX3ekDzLE2O2jieWMao31u8fQt8hOvhFOXV9pnLpCJA 745Jh1kWpDCNMxyZF0Ed1LunGWOYDzxgBmgMncvphuOS13c6wqi73X+1PExl78cmy9Kn ko2wfSajd8pjTnzXrmcNKbF8AJh2Y/Piv8SFQC9XpRT6ogsyjOwJF5oxoFoMNy7Fwr65 g0CA== X-Gm-Message-State: AA6/9RndcSlkZmeMrSrmLy6FmpGboKKKJjOmP4zTgZG25eXTpVWdevDpvs+u9QujjpQ55w== X-Received: by 10.28.227.11 with SMTP id a11mr1900842wmh.88.1476822699148; Tue, 18 Oct 2016 13:31:39 -0700 (PDT) Received: from [192.168.2.21] (p5B072CD7.dip0.t-ipconnect.de. [91.7.44.215]) by smtp.googlemail.com with ESMTPSA id g9sm65003011wjk.25.2016.10.18.13.31.38 for <ffmpeg-devel@ffmpeg.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Oct 2016 13:31:38 -0700 (PDT) From: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> X-Google-Original-From: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Message-ID: <08deadd4-2dc6-27c3-d6f5-af6a85ca622c@googlemail.com> Date: Tue, 18 Oct 2016 22:31:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat: remove request_probe assert from ff_read_packet X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org> List-Unsubscribe: <http://ffmpeg.org/mailman/options/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe> List-Archive: <http://ffmpeg.org/pipermail/ffmpeg-devel/> List-Post: <mailto:ffmpeg-devel@ffmpeg.org> List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help> List-Subscribe: <http://ffmpeg.org/mailman/listinfo/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe> Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org> |
Commit Message
Andreas Cadhalpun
Oct. 18, 2016, 8:31 p.m. UTC
Nothing guarantees to set request_probe to -1, so this assert can be
triggered, e.g. if st->probe_packets is 0.
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
---
I think the reason why this assert isn't triggered way more often is
that the probing code usually works quite well.
---
libavformat/utils.c | 1 -
1 file changed, 1 deletion(-)
Comments
On Tue, Oct 18, 2016 at 10:31:37PM +0200, Andreas Cadhalpun wrote: > Nothing guarantees to set request_probe to -1, so this assert can be > triggered, e.g. if st->probe_packets is 0. probe_codec() called with NULL should cause st->probe_packets = 0 st->request_probe = -1; [...]
On 18.10.2016 22:56, Michael Niedermayer wrote: > On Tue, Oct 18, 2016 at 10:31:37PM +0200, Andreas Cadhalpun wrote: >> Nothing guarantees to set request_probe to -1, so this assert can be >> triggered, e.g. if st->probe_packets is 0. > > probe_codec() called with NULL should cause > st->probe_packets = 0 > st->request_probe = -1; Yes, but request_probe can be change to a different value later on, e.g. in ff_parse_mpeg2_descriptor: int ff_read_packet(AVFormatContext *s, AVPacket *pkt) { [...] if (s->internal->raw_packet_buffer_remaining_size <= 0) if ((err = probe_codec(s, st, NULL)) < 0) // probe_packets = 0, request_probe = -1 return err; [...] ret = s->iformat->read_packet(s, pkt); ~~~ ff_parse_mpeg2_descriptor([...]) { [...] switch (desc_tag) { [...] case 0x05: /* registration descriptor */ [...] st->request_probe = 50; [...] } ~~~ [...] if (st->probe_packets) // still 0 if ((err = probe_codec(s, st, NULL)) < 0) return err; av_assert0(st->request_probe <= 0); // now 50 SIGABRT Best regards, Andreas
On Tue, Oct 18, 2016 at 11:26 PM, Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> wrote: > On 18.10.2016 22:56, Michael Niedermayer wrote: >> On Tue, Oct 18, 2016 at 10:31:37PM +0200, Andreas Cadhalpun wrote: >>> Nothing guarantees to set request_probe to -1, so this assert can be >>> triggered, e.g. if st->probe_packets is 0. >> >> probe_codec() called with NULL should cause >> st->probe_packets = 0 >> st->request_probe = -1; > > Yes, but request_probe can be change to a different value later on, > e.g. in ff_parse_mpeg2_descriptor: > > int ff_read_packet(AVFormatContext *s, AVPacket *pkt) > { > [...] > if (s->internal->raw_packet_buffer_remaining_size <= 0) > if ((err = probe_codec(s, st, NULL)) < 0) // probe_packets = 0, request_probe = -1 > return err; > [...] > ret = s->iformat->read_packet(s, pkt); > ~~~ > ff_parse_mpeg2_descriptor([...]) > { > [...] > switch (desc_tag) { > [...] > case 0x05: /* registration descriptor */ > [...] > st->request_probe = 50; > [...] > } > ~~~ > [...] > if (st->probe_packets) // still 0 > if ((err = probe_codec(s, st, NULL)) < 0) > return err; > av_assert0(st->request_probe <= 0); // now 50 > SIGABRT > Can you actually make that happen, or is that just speculation? - Hendrik
On 18.10.2016 23:46, Hendrik Leppkes wrote: > On Tue, Oct 18, 2016 at 11:26 PM, Andreas Cadhalpun > <andreas.cadhalpun@googlemail.com> wrote: >> On 18.10.2016 22:56, Michael Niedermayer wrote: >>> On Tue, Oct 18, 2016 at 10:31:37PM +0200, Andreas Cadhalpun wrote: >>>> Nothing guarantees to set request_probe to -1, so this assert can be >>>> triggered, e.g. if st->probe_packets is 0. >>> >>> probe_codec() called with NULL should cause >>> st->probe_packets = 0 >>> st->request_probe = -1; >> >> Yes, but request_probe can be change to a different value later on, >> e.g. in ff_parse_mpeg2_descriptor: >> >> int ff_read_packet(AVFormatContext *s, AVPacket *pkt) >> { >> [...] >> if (s->internal->raw_packet_buffer_remaining_size <= 0) >> if ((err = probe_codec(s, st, NULL)) < 0) // probe_packets = 0, request_probe = -1 >> return err; >> [...] >> ret = s->iformat->read_packet(s, pkt); >> ~~~ >> ff_parse_mpeg2_descriptor([...]) >> { >> [...] >> switch (desc_tag) { >> [...] >> case 0x05: /* registration descriptor */ >> [...] >> st->request_probe = 50; >> [...] >> } >> ~~~ >> [...] >> if (st->probe_packets) // still 0 >> if ((err = probe_codec(s, st, NULL)) < 0) >> return err; >> av_assert0(st->request_probe <= 0); // now 50 >> SIGABRT >> > > Can you actually make that happen, or is that just speculation? Yes, at least in ffmpeg 3.1.4 and master with commit 04fa20d reverted. (I do fuzz-testing, not speculating.) Best regards, Andreas
On Tue, Oct 18, 2016 at 11:26:24PM +0200, Andreas Cadhalpun wrote: > On 18.10.2016 22:56, Michael Niedermayer wrote: > > On Tue, Oct 18, 2016 at 10:31:37PM +0200, Andreas Cadhalpun wrote: > >> Nothing guarantees to set request_probe to -1, so this assert can be > >> triggered, e.g. if st->probe_packets is 0. > > > > probe_codec() called with NULL should cause > > st->probe_packets = 0 > > st->request_probe = -1; > > Yes, but request_probe can be change to a different value later on, > e.g. in ff_parse_mpeg2_descriptor: > > int ff_read_packet(AVFormatContext *s, AVPacket *pkt) > { > [...] > if (s->internal->raw_packet_buffer_remaining_size <= 0) > if ((err = probe_codec(s, st, NULL)) < 0) // probe_packets = 0, request_probe = -1 > return err; > [...] > ret = s->iformat->read_packet(s, pkt); > ~~~ > ff_parse_mpeg2_descriptor([...]) > { > [...] > switch (desc_tag) { > [...] > case 0x05: /* registration descriptor */ > [...] > st->request_probe = 50; > [...] > } > ~~~ > [...] > if (st->probe_packets) // still 0 > if ((err = probe_codec(s, st, NULL)) < 0) > return err; > av_assert0(st->request_probe <= 0); // now 50 > SIGABRT hmm, i guess the patch is then ok alternatively you could use i think: @@ -803,7 +803,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; for (i = 0; i < s->nb_streams; i++) { st = s->streams[i]; - if (st->probe_packets) + if (st->probe_packets || st->request_probe > 0) if ((err = probe_codec(s, st, NULL)) < 0) return err; av_assert0(st->request_probe <= 0); [...]
diff --git a/libavformat/utils.c b/libavformat/utils.c index 8a51aea..a62a073 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -806,7 +806,6 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt) if (st->probe_packets) if ((err = probe_codec(s, st, NULL)) < 0) return err; - av_assert0(st->request_probe <= 0); } continue; }