On 06.05.2015 03:35, Luca Barbato wrote:
> From: Andreas Cadhalpun <[email protected]>
> 
> And either error out or set it to 0 if it is negative.
> 
> CC: [email protected]
> Signed-off-by: Luca Barbato <[email protected]>
> ---
> This is what I had in mind.
> 
>  libavformat/avidec.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/libavformat/avidec.c b/libavformat/avidec.c
> index b317b26..4caba46 100644
> --- a/libavformat/avidec.c
> +++ b/libavformat/avidec.c
> @@ -571,6 +571,23 @@ static int avi_read_header(AVFormatContext *s)
>                  av_log(s, AV_LOG_ERROR, "unknown stream type %X\n", tag1);
>                  goto fail;
>              }
> +
> +            if (ast->sample_size < 0) {
> +                if (s->error_recognition & AV_EF_EXPLODE) {
> +                    av_log(s, AV_LOG_ERROR,
> +                           "Invalid sample_size %d at stream %d\n",
> +                           ast->sample_size,
> +                           stream_index);
> +                    goto fail;
> +                }
> +                av_log(s, AV_LOG_WARNING,
> +                       "Invalid sample_size %d at stream %d, "
> +                       "setting it to 0\n",
> +                       ast->sample_size,
> +                       stream_index);
> +                ast->sample_size = 0;
> +            }
> +
>              if (ast->sample_size == 0)
>                  st->duration = st->nb_frames;
>              ast->frame_offset = ast->cum_len;
> --
> 1.9.0

This looks fine, thanks.

Best regards,
Andreas
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to