diff mbox series

[FFmpeg-devel,1/2] avformat/imf: fix invalid resource handling

Message ID 20230426175302.946-1-pal@sandflow.com
State Accepted
Commit 23d968d55a6e00dfc46799cfd0eb2ed02379037d
Headers show
Series [FFmpeg-devel,1/2] avformat/imf: fix invalid resource handling | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Pierre-Anthony Lemieux April 26, 2023, 5:53 p.m. UTC
From: Pierre-Anthony Lemieux <pal@palemieux.com>

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

Comments

Anton Khirnov April 27, 2023, 7:51 a.m. UTC | #1
Quoting pal@sandflow.com (2023-04-26 19:53:01)
> From: Pierre-Anthony Lemieux <pal@palemieux.com>
> 
> ---
>  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 ad84a68b13..a7cf5fa360 100644
> --- a/libavformat/imf_cpl.c
> +++ b/libavformat/imf_cpl.c
> @@ -608,11 +608,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;

Should an error here not propagate to the caller?

Unrelated, but all this logging to NULL is very evil.
diff mbox series

Patch

diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
index ad84a68b13..a7cf5fa360 100644
--- a/libavformat/imf_cpl.c
+++ b/libavformat/imf_cpl.c
@@ -608,11 +608,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);
     }
@@ -691,11 +690,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);
     }