diff mbox

[FFmpeg-devel] avcodec/exr: Allow duplicate use of channel indexes

Message ID 20190926142903.31830-1-michael@niedermayer.cc
State Accepted
Commit 080819b3b4b59ef498511ac349414af85728349c
Headers show

Commit Message

Michael Niedermayer Sept. 26, 2019, 2:29 p.m. UTC
Fixes: Ticket #8203

Reported-by: durandal_1707
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/exr.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Paul B Mahol Oct. 8, 2019, 3:13 p.m. UTC | #1
Why are you not gonna apply this patch?

Fix code you break!

On 9/26/19, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Fixes: Ticket #8203
>
> Reported-by: durandal_1707
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/exr.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/exr.c b/libavcodec/exr.c
> index c12469cc28..29dab36409 100644
> --- a/libavcodec/exr.c
> +++ b/libavcodec/exr.c
> @@ -1307,6 +1307,7 @@ static int decode_header(EXRContext *s, AVFrame
> *frame)
>      int magic_number, version, i, flags, sar = 0;
>      int layer_match = 0;
>      int ret;
> +    int dup_channels = 0;
>
>      s->current_channel_offset = 0;
>      s->xmin               = ~0;
> @@ -1465,10 +1466,12 @@ static int decode_header(EXRContext *s, AVFrame
> *frame)
>                      s->pixel_type                     = current_pixel_type;
>                      s->channel_offsets[channel_index] =
> s->current_channel_offset;
>                  } else if (channel_index >= 0) {
> -                    av_log(s->avctx, AV_LOG_ERROR,
> +                    av_log(s->avctx, AV_LOG_WARNING,
>                              "Multiple channels with index %d.\n",
> channel_index);
> -                    ret = AVERROR_INVALIDDATA;
> -                    goto fail;
> +                    if (++dup_channels > 10) {
> +                        ret = AVERROR_INVALIDDATA;
> +                        goto fail;
> +                    }
>                  }
>
>                  s->channels = av_realloc(s->channels,
> --
> 2.23.0
>
> _______________________________________________
> 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".
Michael Niedermayer Oct. 9, 2019, 2:41 p.m. UTC | #2
On Tue, Oct 08, 2019 at 05:13:42PM +0200, Paul B Mahol wrote:
> Why are you not gonna apply this patch?
> 
> Fix code you break!

I did not treat this patch special
it was on the mailing list waiting for a review like any other bugfix

ill apply it with my next push

Thanks for remining me

[...]
diff mbox

Patch

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index c12469cc28..29dab36409 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1307,6 +1307,7 @@  static int decode_header(EXRContext *s, AVFrame *frame)
     int magic_number, version, i, flags, sar = 0;
     int layer_match = 0;
     int ret;
+    int dup_channels = 0;
 
     s->current_channel_offset = 0;
     s->xmin               = ~0;
@@ -1465,10 +1466,12 @@  static int decode_header(EXRContext *s, AVFrame *frame)
                     s->pixel_type                     = current_pixel_type;
                     s->channel_offsets[channel_index] = s->current_channel_offset;
                 } else if (channel_index >= 0) {
-                    av_log(s->avctx, AV_LOG_ERROR,
+                    av_log(s->avctx, AV_LOG_WARNING,
                             "Multiple channels with index %d.\n", channel_index);
-                    ret = AVERROR_INVALIDDATA;
-                    goto fail;
+                    if (++dup_channels > 10) {
+                        ret = AVERROR_INVALIDDATA;
+                        goto fail;
+                    }
                 }
 
                 s->channels = av_realloc(s->channels,