From patchwork Wed Jan 5 02:42:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Anthony Lemieux X-Patchwork-Id: 33071 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp344655iog; Tue, 4 Jan 2022 18:42:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNCU0Zq9fpDbFb0i0JmHqDxtTXiKfl5TXhK0/CCy8A3DWe9EI72SKkkh8QKmbhH5nPqmiW X-Received: by 2002:aa7:d6d5:: with SMTP id x21mr51506733edr.201.1641350572255; Tue, 04 Jan 2022 18:42:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641350572; cv=none; d=google.com; s=arc-20160816; b=oA9PGpLmJgP0nhW42HUFFSe8cga0NckMDg6LyxBqrrj8sr0J29WuVdC8vlToD8BQeE wkOz4/pnuxECXzz5SBo1u0J8vLScDSsqMH7DBHAkerVbedDvNOMeQvg07o+WlHI1oB1n 4cOaQ67xuRZSNAYKRDsJnBJTeZiAFppwNESnVrahfrZX+uzWNIpwhIEDgXlsqLdMKJMk ApmK/zl8ete/fh0sslVy6QMBS5oSNJIRGXEZzuSUAqcp/kQo40LGFf729xhjue8Ds2he MxAW42dQcWNa+vPmhBKTS65mlgijpC7/Py/Rnt0UPVMaNpoceQ645pN0WvDP0y6fp3ig pO4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=GNn17iKYQEMLDecSyK2Cz7yiYXgSD4mpOQsAcfLfqsI=; b=cTCqTd5Ry6hinyWW4THSpAVxT8NdneaEGoiNJ/vww/3q5BPfJ7EvacW/ipHEMm2msq 9yEIZofpGA9fRbobatc2Mbcw9QQU1Tf3groztbHu50xSfZ9p1t+ScHK3DaWfz4e1d6Jo KG63cX8xB3Uw57/j8/E/2FWA4vj3g1T6Z39QXs4z58A2CvhNAVZXJV3S9a5c77ngrPUG Wcx62iyBmWB871TxZM2NnZ0B8iCe1cG3I8OBcojlIRG88Bev6iYI2sPMIXsKnDDQVC6/ 8M24xNdbipM3ZlZ+aYMoQLIoez4ZTQNKpKOjsbTUi0GiD1pv0f5ue1CnMb0sOaL8gRmB eKig== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i1si19955295ejy.363.2022.01.04.18.42.52; Tue, 04 Jan 2022 18:42:52 -0800 (PST) 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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E6C0368A8F5; Wed, 5 Jan 2022 04:42:47 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A214E68A921 for ; Wed, 5 Jan 2022 04:42:41 +0200 (EET) Received: by mail-pj1-f53.google.com with SMTP id c14-20020a17090a674e00b001b31e16749cso409710pjm.4 for ; Tue, 04 Jan 2022 18:42:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ltf90Z2v+m4a8xLS55Ru1Y4ubf5xMWVuGBZGuN9hPSE=; b=wx6h58fRAItwSmpsgSXJYLkAik6oSSSNEb71zxKxWfPU2dOBeI466j2QhDcEwy5OjK MdL1piIOXSXTLwss4vWIsrKXlaehrEOJydqZnMcnViop6IjetKjSKryLeJ4vCcvAi7b8 pFvihOR88nCmc/ZUePYMXSYm8YblKGfVOej/nDmM8N1UakPqnXw8NBt2M8YCKVFXEp6h 63AjzuwIy/9oPjzfk/cTocBg4/LYT58Fg7MwQ7ZqMZUSRbpiOGMh1+XXbYqqWzZFzRoO 4dFyLkrz/uKMnNF1c2FODoUtpAtfIeRAsTvLkel3jjkQhg8voCNt0mmSIHnuS28Ij1DJ QtkA== X-Gm-Message-State: AOAM532ij3XW9SWbWBTizBwj6tG9jwMawNCdEhSG4VfglKdqi72pHy45 BSSOvqzMh2jahMw4J2VC7FI4TAg/Yo0= X-Received: by 2002:a17:902:a509:b0:143:7eb6:c953 with SMTP id s9-20020a170902a50900b001437eb6c953mr52107682plq.4.1641350559722; Tue, 04 Jan 2022 18:42:39 -0800 (PST) Received: from localhost (76-14-89-2.sf-cable.astound.net. [76.14.89.2]) by smtp.gmail.com with ESMTPSA id e24sm590561pjt.45.2022.01.04.18.42.38 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Jan 2022 18:42:39 -0800 (PST) Received: by localhost (sSMTP sendmail emulation); Tue, 04 Jan 2022 18:42:36 -0800 From: pal@sandflow.com To: ffmpeg-devel@ffmpeg.org Date: Tue, 4 Jan 2022 18:42:06 -0800 Message-Id: <20220105024207.27508-1-pal@sandflow.com> X-Mailer: git-send-email 2.34.1.windows.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 1/2] avformat/imf: fix CPL parsing error handling 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: Pierre-Anthony Lemieux Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: gjgIqZieswGN From: Pierre-Anthony Lemieux Signed-off-by: Pierre-Anthony Lemieux --- libavformat/imf_cpl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c index 7055b49ae8..f49469f56e 100644 --- a/libavformat/imf_cpl.c +++ b/libavformat/imf_cpl.c @@ -807,7 +807,9 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl) av_log(NULL, AV_LOG_ERROR, "Cannot read IMF CPL\n"); if (ret == 0) ret = AVERROR_INVALIDDATA; - } else { + goto clean_up; + } + LIBXML_TEST_VERSION filesize = buf.len; @@ -817,6 +819,7 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl) AV_LOG_ERROR, "XML parsing failed when reading the IMF CPL\n"); ret = AVERROR_INVALIDDATA; + goto clean_up; } if ((ret = ff_imf_parse_cpl_from_xml_dom(doc, cpl))) { @@ -833,8 +836,8 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl) } xmlFreeDoc(doc); - } +clean_up: av_bprint_finalize(&buf, NULL); return ret; From patchwork Wed Jan 5 02:42:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Anthony Lemieux X-Patchwork-Id: 33072 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp344755iog; Tue, 4 Jan 2022 18:43:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUfAacfcS1CguLSk8XnB9cHUsjZE6HTLbuHOkRXvT4KTXOEqnGM23206BOw+ZDqOQJmvrd X-Received: by 2002:a17:907:c9f:: with SMTP id gi31mr43287095ejc.438.1641350582233; Tue, 04 Jan 2022 18:43:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641350582; cv=none; d=google.com; s=arc-20160816; b=Li6lmaexVyzmL4vemhvbARO4LYX4jBD3ZmTIEJ1ekw6K/0X5A0WyIVDpUQG4WtVXDs UjF5hNTe5mUKYewjvLo1Jmpi5A6xhJyYIWi+ycCtdOTfDXdAtR3FYCRo050YWvZsKrQ2 QuLyjosnWpJhtF4Ksu7IrCsHzlmlJ4VZt/0YX+O/AKxT1QEHxFGT2UxogIDeKmm3NrLB zGaByxURFDNwn82FYhJOAW39ECG3rwF0gkt4Ei3cGz8kXdq+Ry5N95WHd0niTh8eijvT FjPnHXAZZ8MPJab097VLaWRM19x6lf8j3y3AUw9yLekiJUoDHJhttX6MAuiLjIcJBkjg aelg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=ugAqyPh6Mqa96jYhEfsOpKxRqw2YxjwvEHyHmReEm6U=; b=ujQMxGKNG41TSFwgXOATt9c3QJvi9zMAV9hBxD5pmiNBrRejKA9vpwMqqWYzUJPrVm OcNO76qiPI/teCDOL/5vmEKHYfknp2auQwakLdHjWFZ9wwfsVc/5cH3lesqnErpDavQP 04Rg3Mp50a36XS6N263YJbniPLOAvKEoTvemdSgfgxLh/x8oNLcXOlusm8ERMlwCRlL9 xdC9QLIaNTOZyBAY5DCpVA4rJts7OaDtKkPjFRdh7E7FCC7BGFkzyaaDoqjxCNYDAEIN kLc/erK3Hnl+OPBCAfYinR9uROzwnKfFLgVpf5/jgNEHmYvkogR8ism+WSJuZHM7lBqX 2nZg== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g12si20392839edz.11.2022.01.04.18.43.01; Tue, 04 Jan 2022 18:43:02 -0800 (PST) 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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3052B68A9AD; Wed, 5 Jan 2022 04:42:54 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B37E568A93E for ; Wed, 5 Jan 2022 04:42:47 +0200 (EET) Received: by mail-pg1-f177.google.com with SMTP id 8so34266941pgc.10 for ; Tue, 04 Jan 2022 18:42:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jnZiA+qRUJqJDXFlzNd4UEOyRFyrTgLDmVQxh7RHdJY=; b=HY2fo2rnIF1+gvw4LVTk6FYfYPkaKq64HqIRc8KnEP6EReYgJHp0J+7JKs/tMA3vlU CdfA2uK5DKNtaR4E5uOl1oZ12texuS3cUC6vWopqrIzOBG69Em9zUm425PQv6uE75nbG nKPTC7brB2qccHQG5WxOnWoxygsRHgkQM98VxzphQNMPDSCvcDuBkRXnfd+Cj0Wl10Br 7fka6GnLegkWwJgKqrhWqSHgQHQFpc7q+uKPii0Q3qD0iYSUzRQP6O/fI6Gc9FeMFL/L HIfDWyqcnAFBNjgqc+m5gS4ahZs9Xsm4ZPb5iG0XDqi7Tm7/tbPllVYZBPoRabTo1DcD Td/g== X-Gm-Message-State: AOAM531bqrYnCQJitBY68e7YaJMJZXy33v52zknfm6aMdFBkwPxIdCIH /Em2GhwMMuD/kaVrzpIEWM2Js2sGQm4= X-Received: by 2002:a05:6a00:a8e:b0:4a4:ec38:b66a with SMTP id b14-20020a056a000a8e00b004a4ec38b66amr52629476pfl.7.1641350565813; Tue, 04 Jan 2022 18:42:45 -0800 (PST) Received: from localhost (76-14-89-2.sf-cable.astound.net. [76.14.89.2]) by smtp.gmail.com with ESMTPSA id l145sm42908335pfd.117.2022.01.04.18.42.44 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Jan 2022 18:42:45 -0800 (PST) Received: by localhost (sSMTP sendmail emulation); Tue, 04 Jan 2022 18:42:42 -0800 From: pal@sandflow.com To: ffmpeg-devel@ffmpeg.org Date: Tue, 4 Jan 2022 18:42:07 -0800 Message-Id: <20220105024207.27508-2-pal@sandflow.com> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20220105024207.27508-1-pal@sandflow.com> References: <20220105024207.27508-1-pal@sandflow.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/2] avformat/imf: Fix indentation 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: Pierre-Anthony Lemieux Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: nEeu/8iMx+sk From: Pierre-Anthony Lemieux Signed-off-by: Pierre-Anthony Lemieux --- libavformat/imf_cpl.c | 48 +++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c index f49469f56e..32e805cdd4 100644 --- a/libavformat/imf_cpl.c +++ b/libavformat/imf_cpl.c @@ -810,32 +810,32 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl) goto clean_up; } - LIBXML_TEST_VERSION - - filesize = buf.len; - doc = xmlReadMemory(buf.str, filesize, NULL, NULL, 0); - if (!doc) { - av_log(NULL, - AV_LOG_ERROR, - "XML parsing failed when reading the IMF CPL\n"); - ret = AVERROR_INVALIDDATA; - goto clean_up; - } + LIBXML_TEST_VERSION + + filesize = buf.len; + doc = xmlReadMemory(buf.str, filesize, NULL, NULL, 0); + if (!doc) { + av_log(NULL, + AV_LOG_ERROR, + "XML parsing failed when reading the IMF CPL\n"); + ret = AVERROR_INVALIDDATA; + goto clean_up; + } - if ((ret = ff_imf_parse_cpl_from_xml_dom(doc, cpl))) { - av_log(NULL, AV_LOG_ERROR, "Cannot parse IMF CPL\n"); - } else { - av_log(NULL, - AV_LOG_INFO, - "IMF CPL ContentTitle: %s\n", - (*cpl)->content_title_utf8); - av_log(NULL, - AV_LOG_INFO, - "IMF CPL Id: " FF_IMF_UUID_FORMAT "\n", - UID_ARG((*cpl)->id_uuid)); - } + if ((ret = ff_imf_parse_cpl_from_xml_dom(doc, cpl))) { + av_log(NULL, AV_LOG_ERROR, "Cannot parse IMF CPL\n"); + } else { + av_log(NULL, + AV_LOG_INFO, + "IMF CPL ContentTitle: %s\n", + (*cpl)->content_title_utf8); + av_log(NULL, + AV_LOG_INFO, + "IMF CPL Id: " FF_IMF_UUID_FORMAT "\n", + UID_ARG((*cpl)->id_uuid)); + } - xmlFreeDoc(doc); + xmlFreeDoc(doc); clean_up: av_bprint_finalize(&buf, NULL);