X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fptx.c;h=47b8926f73febc38301d13efe716c691ae30337c;hb=83b6471dcb762859f20b2c414decc755fcceb5e8;hp=42147f4afce6d55742d26955cd4d6b9394ccaa03;hpb=26148e923613e718787c6fc4bf3f64e8909f597c;p=ffmpeg diff --git a/libavcodec/ptx.c b/libavcodec/ptx.c index 42147f4afce..47b8926f73f 100644 --- a/libavcodec/ptx.c +++ b/libavcodec/ptx.c @@ -55,6 +55,9 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, buf += offset; + if (buf_end - buf < w * bytes_per_pixel) + return AVERROR_INVALIDDATA; + if ((ret = ff_set_dimensions(avctx, w, h)) < 0) return ret; @@ -82,7 +85,7 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return offset + w*h*bytes_per_pixel; } -AVCodec ff_ptx_decoder = { +const AVCodec ff_ptx_decoder = { .name = "ptx", .long_name = NULL_IF_CONFIG_SMALL("V.Flash PTX image"), .type = AVMEDIA_TYPE_VIDEO,