diff mbox series

[FFmpeg-devel,v1] avformat/imf: fix error CPL root element is absent

Message ID 20220104061127.398-1-pal@sandflow.com
State New
Headers show
Series [FFmpeg-devel,v1] avformat/imf: fix error CPL root element is absent | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc fail Make fate failed

Commit Message

Pierre-Anthony Lemieux Jan. 4, 2022, 6:11 a.m. UTC
From: Pierre-Anthony Lemieux <pal@palemieux.com>

Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com>
---

Notes:
    Found through manual fuzzing.

 libavformat/imf_cpl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Zane van Iperen Jan. 5, 2022, 12:37 a.m. UTC | #1
On 4/1/22 16:11, pal@sandflow.com wrote:
>       cpl_element = xmlDocGetRootElement(doc);
> -    if (xmlStrcmp(cpl_element->name, "CompositionPlaylist")) {
> +    if ((!cpl_element) || xmlStrcmp(cpl_element->name, "CompositionPlaylist")) {

Nit: Extra set of parens around "!cpl_element".

Otherwise, this lgtm, I'll apply and backport this soon with that change.
diff mbox series

Patch

diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
index 7055b49ae8..167244a5a2 100644
--- a/libavformat/imf_cpl.c
+++ b/libavformat/imf_cpl.c
@@ -688,7 +688,7 @@  int ff_imf_parse_cpl_from_xml_dom(xmlDocPtr doc, FFIMFCPL **cpl)
     }
 
     cpl_element = xmlDocGetRootElement(doc);
-    if (xmlStrcmp(cpl_element->name, "CompositionPlaylist")) {
+    if ((!cpl_element) || xmlStrcmp(cpl_element->name, "CompositionPlaylist")) {
         av_log(NULL, AV_LOG_ERROR, "The root element of the CPL is not CompositionPlaylist\n");
         ret = AVERROR_INVALIDDATA;
         goto cleanup;