[FFmpeg-devel] [PATCH] dpx: prevent segfault on malformed input

Paul B Mahol onemda at gmail.com
Sat Nov 24 09:32:54 CET 2012


On 11/24/12, Peter Ross <pross at xvid.org> wrote:
> Signed-off-by: Peter Ross <pross at xvid.org>
> ---
>  libavcodec/dpx.c |    5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
> index bfc88b6..3c5e753 100644
> --- a/libavcodec/dpx.c
> +++ b/libavcodec/dpx.c
> @@ -76,6 +76,11 @@ static int decode_frame(AVCodecContext *avctx,
>      unsigned int rgbBuffer = 0;
>      int n_datum = 0;
>
> +    if (avctx->width <= 0 || avctx->height <= 0) {
> +        av_log(avctx, AV_LOG_ERROR, "Invalid width or height\n");
> +        return AVERROR_INVALIDDATA;
> +    }
> +

decoder already do this but at wrong position in file, see av_image_check_size()
>      if (avpkt->size <= 1634) {
>          av_log(avctx, AV_LOG_ERROR, "Packet too small for DPX header\n");
>          return AVERROR_INVALIDDATA;
> --
> 1.7.10.4
>
> -- Peter
> (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
>


More information about the ffmpeg-devel mailing list