[FFmpeg-cvslog] avformat/imf: fix invalid resource handling

Pierre-Anthony Lemieux git at videolan.org
Mon Oct 30 02:09:17 EET 2023


ffmpeg | branch: release/5.1 | Pierre-Anthony Lemieux <pal at palemieux.com> | Wed Apr 26 08:09:40 2023 -0700| [c2d4ab255259c864313d433c5755fad2bf0219f4] | committer: Michael Niedermayer

avformat/imf: fix invalid resource handling

(cherry picked from commit 23d968d55a6e00dfc46799cfd0eb2ed02379037d)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c2d4ab255259c864313d433c5755fad2bf0219f4
---

 libavformat/imf_cpl.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
index 4acc20feee..f2c6b6f064 100644
--- a/libavformat/imf_cpl.c
+++ b/libavformat/imf_cpl.c
@@ -511,11 +511,10 @@ static int push_main_audio_sequence(xmlNodePtr audio_sequence_elem, FFIMFCPL *cp
         ret = fill_trackfile_resource(resource_elem,
                                       &vt->resources[vt->resource_count],
                                       cpl);
-        vt->resource_count++;
-        if (ret) {
+        if (ret)
             av_log(NULL, AV_LOG_ERROR, "Invalid Resource\n");
-            continue;
-        }
+        else
+            vt->resource_count++;
 
         resource_elem = xmlNextElementSibling(resource_elem);
     }
@@ -594,11 +593,10 @@ static int push_main_image_2d_sequence(xmlNodePtr image_sequence_elem, FFIMFCPL
         ret = fill_trackfile_resource(resource_elem,
                                       &cpl->main_image_2d_track->resources[cpl->main_image_2d_track->resource_count],
                                       cpl);
-        cpl->main_image_2d_track->resource_count++;
-        if (ret) {
+        if (ret)
             av_log(NULL, AV_LOG_ERROR, "Invalid Resource\n");
-            continue;
-        }
+        else
+            cpl->main_image_2d_track->resource_count++;
 
         resource_elem = xmlNextElementSibling(resource_elem);
     }



More information about the ffmpeg-cvslog mailing list