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 B9CF0411BE for ; Tue, 4 Jan 2022 06:11:11 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0775468B0B2; Tue, 4 Jan 2022 08:11:09 +0200 (EET) Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DE1B168B036 for ; Tue, 4 Jan 2022 08:11:02 +0200 (EET) Received: by mail-pj1-f42.google.com with SMTP id iy13so30510793pjb.5 for ; Mon, 03 Jan 2022 22:11:02 -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=KxF92+NxF9NNDjHh7mflbQa8br4ingXYPNwOfQoPVeQ=; b=Tv1zJxf2mPN8CUhDo3KcLivQBpBMAvy3b3iz/VlEFrjZ2tksSeDNMVjMyE3dO8l9RH XrI4VcUOVgwVxgJ81IaBB9Qls04rn+S7dPP47wuCn8ToADH0oRQpY1v2JjBe/ADvEsz4 /XEIhk36bEfyOiz/brHJmP7ZOshSsjPrZP3FCwPu7YMFSqw6JmiEQ7oUDiwA6ZfYNgLC bH9tMBEdQqVkX3p9l/MzLavdOMEKBvbVOGMCXkpUXZBZltHh/JyPl2UYmIVHP6N7EuAF 5RzHu89REnLgWroZIYIFU9St1SOXkz3RNa7Bw0DLO+jSH2vbtWX0+49wA57dWwBsiUVP MQFQ== X-Gm-Message-State: AOAM532Nb1AmTHg8H9857UkXTHihxdaWCh1dCRaPeK70gn0TjHuZ9tbF 67EhJHZvZfk7h6iOgi2StieA/MhHp/E= X-Google-Smtp-Source: ABdhPJy7RQBwwDYbnOLv5RTaZHUjt45MgK6Rw9qJFDHuR2XLbYiLi1VUZwedquaBFzfQfQE+wSHTgg== X-Received: by 2002:a17:90b:234c:: with SMTP id ms12mr59288017pjb.36.1641276660883; Mon, 03 Jan 2022 22:11:00 -0800 (PST) Received: from localhost (76-14-89-2.sf-cable.astound.net. [76.14.89.2]) by smtp.gmail.com with ESMTPSA id rm6sm9873411pjb.35.2022.01.03.22.10.58 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jan 2022 22:11:00 -0800 (PST) Received: by localhost (sSMTP sendmail emulation); Mon, 03 Jan 2022 22:10:57 -0800 From: pal@sandflow.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 3 Jan 2022 22:10:56 -0800 Message-Id: <20220104061056.32737-1-pal@sandflow.com> X-Mailer: git-send-email 2.34.1.windows.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v1] 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 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: From: Pierre-Anthony Lemieux Signed-off-by: Pierre-Anthony Lemieux --- libavformat/imf_cpl.c | 51 +++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c index 167244a5a2..72fc7ffec8 100644 --- a/libavformat/imf_cpl.c +++ b/libavformat/imf_cpl.c @@ -807,34 +807,37 @@ 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 { - 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)); - } + LIBXML_TEST_VERSION - xmlFreeDoc(doc); + 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)); + } + + xmlFreeDoc(doc); + +clean_up: av_bprint_finalize(&buf, NULL); return ret; -- 2.17.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".