From: Pierre-Anthony Lemieux <pal@sandflow.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: Marton Balint <cus@passwd.hu>
Subject: Re: [FFmpeg-devel] [PATCH] avformat/imf_cpl: do not use filesize when reading XML file
Date: Wed, 2 Feb 2022 17:53:09 -0800
Message-ID: <CAF_7JxCjdBs_MmwWE57thhuNmOv+z_=t_koDJv8i0_03BES1CA@mail.gmail.com> (raw)
In-Reply-To: <20220131231334.29017-1-cus@passwd.hu>
Works for me.
There are several other IMF-related patches waiting, some of them
rather trivial. Should they be combined and/or merged together?
On Mon, Jan 31, 2022 at 3:13 PM Marton Balint <cus@passwd.hu> wrote:
>
> Similar to the earlier patch applied to imfdec.
>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> libavformat/imf_cpl.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
> index f2ad9c05d6..102a6b4549 100644
> --- a/libavformat/imf_cpl.c
> +++ b/libavformat/imf_cpl.c
> @@ -797,13 +797,11 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
> AVBPrint buf;
> xmlDoc *doc = NULL;
> int ret = 0;
> - int64_t filesize = 0;
>
> - filesize = avio_size(in);
> - filesize = filesize > 0 ? filesize : 8192;
> - av_bprint_init(&buf, filesize + 1, AV_BPRINT_SIZE_UNLIMITED);
> - ret = avio_read_to_bprint(in, &buf, UINT_MAX - 1);
> - if (ret < 0 || !avio_feof(in) || buf.len == 0) {
> + av_bprint_init(&buf, 0, INT_MAX); // xmlReadMemory uses integer length
> +
> + ret = avio_read_to_bprint(in, &buf, SIZE_MAX);
> + if (ret < 0 || !avio_feof(in)) {
> av_log(NULL, AV_LOG_ERROR, "Cannot read IMF CPL\n");
> if (ret == 0)
> ret = AVERROR_INVALIDDATA;
> @@ -812,8 +810,7 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
>
> LIBXML_TEST_VERSION
>
> - filesize = buf.len;
> - doc = xmlReadMemory(buf.str, filesize, NULL, NULL, 0);
> + doc = xmlReadMemory(buf.str, buf.len, NULL, NULL, 0);
> if (!doc) {
> av_log(NULL,
> AV_LOG_ERROR,
> --
> 2.31.1
>
> _______________________________________________
> 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".
prev parent reply other threads:[~2022-02-03 1:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-31 23:13 Marton Balint
2022-02-03 1:53 ` Pierre-Anthony Lemieux [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAF_7JxCjdBs_MmwWE57thhuNmOv+z_=t_koDJv8i0_03BES1CA@mail.gmail.com' \
--to=pal@sandflow.com \
--cc=cus@passwd.hu \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git