[FFmpeg-devel] [PATCH 3/3] diracdec: check return code of get_buffer_with_edge

Rostislav Pehlivanov atomnuker at gmail.com
Fri Nov 4 21:08:48 EET 2016


On 4 November 2016 at 18:11, Andreas Cadhalpun <
andreas.cadhalpun at googlemail.com> wrote:

> If it fails, buffers aren't allocated, causing NULL pointer dereferencing.
>
> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> ---
>  libavcodec/diracdec.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
> index bb314d0..e0604af 100644
> --- a/libavcodec/diracdec.c
> +++ b/libavcodec/diracdec.c
> @@ -1975,7 +1975,9 @@ static int dirac_decode_picture_header(DiracContext
> *s)
>              for (j = 0; j < MAX_FRAMES; j++)
>                  if (!s->all_frames[j].avframe->data[0]) {
>                      s->ref_pics[i] = &s->all_frames[j];
> -                    get_buffer_with_edge(s->avctx,
> s->ref_pics[i]->avframe, AV_GET_BUFFER_FLAG_REF);
> +                    ret = get_buffer_with_edge(s->avctx,
> s->ref_pics[i]->avframe, AV_GET_BUFFER_FLAG_REF);
> +                    if (ret < 0)
> +                        return ret;
>                      break;
>                  }
>
> --
> 2.10.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

LGTM, thanks


More information about the ffmpeg-devel mailing list