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 2C328428A9 for ; Mon, 10 Jan 2022 00:37:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5281A68ADDC; Mon, 10 Jan 2022 02:37:48 +0200 (EET) Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 89A5C68A6B6 for ; Mon, 10 Jan 2022 02:37:42 +0200 (EET) Received: by mail-io1-f49.google.com with SMTP id y70so15465328iof.2 for ; Sun, 09 Jan 2022 16:37:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandflow-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=78szc7yIAKrOzxBsWsN/Ep7x4b7rzhQGJCiZLBUZY7c=; b=QtEH5ViuOZxYkOumsTsFKOUXHVgjPbeZwI7Q9bSCro3Ysj48LTd8EqAep+3I7VKOjD 0E8EDpLeItNPeaQv75WcAtFaGlAmFS3kzszS9KUGnBXx80ncpZKTR5JJU5pUfaAKbbxJ q/vYnNdNN7twcXwY1x86P7aX+vqSnwNC+5COmbSKS7d2HpgbAcYOgmn0nx8QmNET8Mtv f3bXNYlsvdjPMFBhw/GeRz8OHmYIpvxeVRp59Ahh82G+cS5RHYG6oNoGtFQNwV3tWl2X tVmKP9CbYNTk4juu9iljnOEbyPGBiLgkuH5d+Ysg88ZOeilR4Dm1qikMu1abAEh4e+Cs WSSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=78szc7yIAKrOzxBsWsN/Ep7x4b7rzhQGJCiZLBUZY7c=; b=qp7CiJN5ZMDeoFyt10ot/pEWWmpVMXK59Hzs7bMZR/lqkJgG1h4l9r3bOh6utLix6f xyhZ0zwlTC3xaJIRyIr15bjLiJa5aehK4EX4Jh8V/y6rB9gkMEaxjuPBsGoI0TLDX8ON roeV/jwSu91b3+PixAEAT1K65/7Y20u6yI0mH38pSwVGqzfa8mMAjeewvrA6S6C64A33 4jBd82UJ+LXcGSiE9FG/k+i4F5eF2VsZbUWjlEk7w2Krs/otAIG2IZ5FGkxv0KNuLv0d 8GyBfDOFBN4WF3kTRIi4Husnb8s0sKaGc2s5tD3bOzlxsOcqWx1qmWsB8PJm/sQz2h0l 0afg== X-Gm-Message-State: AOAM533AVvs4L0NzYJMGSzQJKD85xIjeGH5yj8ZOzwNPlaCYNp2mPHIc LWCEEJeKg8In/wglwRz04aI3hqjzuZ0loQ== X-Google-Smtp-Source: ABdhPJzShkwnC0fhFrl7/fbqRZQUF5lSkg4GWIaLoadBoblREqCm6iND2D9FIGF1C4qmL59eXqpzJA== X-Received: by 2002:a02:caa1:: with SMTP id e1mr32620188jap.105.1641775060691; Sun, 09 Jan 2022 16:37:40 -0800 (PST) Received: from mail-il1-f177.google.com (mail-il1-f177.google.com. [209.85.166.177]) by smtp.gmail.com with ESMTPSA id c15sm194567ilq.62.2022.01.09.16.37.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 Jan 2022 16:37:40 -0800 (PST) Received: by mail-il1-f177.google.com with SMTP id o20so3507236ill.0 for ; Sun, 09 Jan 2022 16:37:40 -0800 (PST) X-Received: by 2002:a92:ca48:: with SMTP id q8mr33075687ilo.177.1641775059460; Sun, 09 Jan 2022 16:37:39 -0800 (PST) MIME-Version: 1.0 References: <20220101192001.13688-1-cus@passwd.hu> In-Reply-To: From: Pierre-Anthony Lemieux Date: Sun, 9 Jan 2022 16:37:42 -0800 X-Gmail-Original-Message-ID: Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH 1/2] avformat/imfdec: do not use filesize when reading XML file 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 Sat, Jan 8, 2022 at 10:49 AM Marton Balint wrote: > > > > On Sat, 1 Jan 2022, Marton Balint wrote: > > > Signed-off-by: Marton Balint > > --- > > libavformat/imfdec.c | 15 ++++----------- > > 1 file changed, 4 insertions(+), 11 deletions(-) > > > > diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c > > index f17064cfcd..ef1e7cf206 100644 > > --- a/libavformat/imfdec.c > > +++ b/libavformat/imfdec.c > > @@ -73,8 +73,6 @@ > > #include > > #include > > > > -#define MAX_BPRINT_READ_SIZE (UINT_MAX - 1) > > -#define DEFAULT_ASSETMAP_SIZE 8 * 1024 > > #define AVRATIONAL_FORMAT "%d/%d" > > #define AVRATIONAL_ARG(rational) rational.num, rational.den > > > > @@ -279,7 +277,6 @@ static int parse_assetmap(AVFormatContext *s, const char *url) > > const char *base_url; > > char *tmp_str = NULL; > > int ret; > > - int64_t filesize; > > > > av_log(s, AV_LOG_DEBUG, "Asset Map URL: %s\n", url); > > > > @@ -289,13 +286,10 @@ static int parse_assetmap(AVFormatContext *s, const char *url) > > if (ret < 0) > > return ret; > > > > - filesize = avio_size(in); > > - filesize = filesize > 0 ? filesize : DEFAULT_ASSETMAP_SIZE; > > + av_bprint_init(&buf, 0, INT_MAX); // xmlReadMemory uses integer length > > > > - av_bprint_init(&buf, filesize + 1, AV_BPRINT_SIZE_UNLIMITED); > > - > > - ret = avio_read_to_bprint(in, &buf, MAX_BPRINT_READ_SIZE); > > - if (ret < 0 || !avio_feof(in) || buf.len == 0) { > > + ret = avio_read_to_bprint(in, &buf, SIZE_MAX); > > + if (ret < 0 || !avio_feof(in)) { > > av_log(s, AV_LOG_ERROR, "Unable to read to asset map '%s'\n", url); > > if (ret == 0) > > ret = AVERROR_INVALIDDATA; > > @@ -311,8 +305,7 @@ static int parse_assetmap(AVFormatContext *s, const char *url) > > } > > base_url = av_dirname(tmp_str); > > > > - filesize = buf.len; > > - doc = xmlReadMemory(buf.str, filesize, url, NULL, 0); > > + doc = xmlReadMemory(buf.str, buf.len, url, NULL, 0); > > > > ret = parse_imf_asset_map_from_xml_dom(s, doc, &c->asset_locator_map, base_url); > > if (!ret) > > Will apply the series tomorrow. It looks like the same code exists at libavformat/imf_cpl.c [1]. [1] https://github.com/FFmpeg/FFmpeg/blob/ce4d459db186a7d8ac842685cd6256c9ac1b7f25/libavformat/imf_cpl.c#L795 Does it need to be changed there as well? > > Regards, > Marton > _______________________________________________ > 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". _______________________________________________ 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".