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 3334E40A5A for ; Thu, 3 Feb 2022 01:53:34 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EF57168B187; Thu, 3 Feb 2022 03:53:31 +0200 (EET) Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EA42A68AFBA for ; Thu, 3 Feb 2022 03:53:24 +0200 (EET) Received: by mail-io1-f44.google.com with SMTP id w7so1434379ioj.5 for ; Wed, 02 Feb 2022 17:53:24 -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 :cc; bh=3WGIQtbYSpyiqh5Dmw3OwuvVpLRh45vZP5aLEHzok1w=; b=vzi+UjrEhaBci7kL91oW4M87w1RG3s7OgmR0t8FSUM37VpdnR8wrIs0FW5xEQERcly 9vs5mLJT1u3IeGniD4QdI2AxeP2WQCMOP8ou68nlzMzqYOJ4uXz1oMLjFqsDyzL/3xCp lUKQF3ximxSVQD/1EXPSWyZqabbFA/S8bmWrdbNx4o2rRQN1JcBbX9SKct7Xthh1OSCR u0GKv3ExXzvJABTDkL/PVfy9sp5VUcnreWcNY4Oj5ghm10cxpUZVTf5iwq2okwQxx063 5ccA2gPy2FpWTWBjXfIcRUv2Ayx0QRmt/wcda8enaZNXCjzXM0tOmNBWIguFzvRWy1Ft qfBQ== 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:cc; bh=3WGIQtbYSpyiqh5Dmw3OwuvVpLRh45vZP5aLEHzok1w=; b=NO3KGHCqsKoS1lhA3qKAVWOTzenzQQwrFbcfb8AezrWGHNxmgFc/46lUDMWHz6Um4M exN9Jb7okhuhzkDoT6IbPWsT6YDrfyJkpyeO3YxriIEzBSlAfCAJ7Ytncb525pJMhfuj 48+VJZEw/m3tjGcSVYU5/Uo9OTd6SLPK9Goi9dKb5X8PxPzTf0EB7l1yGSKzIX/eIxWa 93UIRCvE2PeQwD3KnC9Qms1zQVeRPmFFWwCm+UVA4zcap6OF4pWdpgJHYdyZ9+bH1eHq Nx9ItMv4sh3NtqH96EUY2mWu26Z2BVOjQbt2MrJbLYvHHfgNBNjoS6RnfBz35ATKm2S0 zHmg== X-Gm-Message-State: AOAM531SjMFMMZpoxpj/DITOuxgEon5qBfje/PHHJKAluW0cbvPk+V3c BbIRi7elEPqQVYWw4NX60C6z6yG4BUaPow== X-Google-Smtp-Source: ABdhPJxTVaRVhxfyaPzYK+vOPvJAS+fli8AF5X32HGTeF+qlsa2mtdPvWc8HfPxW8DUX5v1N6xmphg== X-Received: by 2002:a02:7056:: with SMTP id f83mr15764510jac.231.1643853202967; Wed, 02 Feb 2022 17:53:22 -0800 (PST) Received: from mail-io1-f53.google.com (mail-io1-f53.google.com. [209.85.166.53]) by smtp.gmail.com with ESMTPSA id d80sm11856677iof.15.2022.02.02.17.53.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Feb 2022 17:53:22 -0800 (PST) Received: by mail-io1-f53.google.com with SMTP id y84so1500413iof.0 for ; Wed, 02 Feb 2022 17:53:21 -0800 (PST) X-Received: by 2002:a02:7a56:: with SMTP id z22mr16392895jad.304.1643853201441; Wed, 02 Feb 2022 17:53:21 -0800 (PST) MIME-Version: 1.0 References: <20220131231334.29017-1-cus@passwd.hu> In-Reply-To: <20220131231334.29017-1-cus@passwd.hu> From: Pierre-Anthony Lemieux Date: Wed, 2 Feb 2022 17:53:09 -0800 X-Gmail-Original-Message-ID: Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH] avformat/imf_cpl: 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 Cc: Marton Balint 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: 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 wrote: > > Similar to the earlier patch applied to imfdec. > > Signed-off-by: Marton Balint > --- > 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".