diff options
Diffstat (limited to 'libavcodec/rawdec.c')
-rw-r--r-- | libavcodec/rawdec.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index 503351e68a..1c1f52f3a9 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -151,6 +151,9 @@ static int raw_decode(AVCodecContext *avctx, frame->top_field_first = context->tff; } + if(buf_size < context->length - (avctx->pix_fmt==PIX_FMT_PAL8 ? 256*4 : 0)) + return -1; + //2bpp and 4bpp raw in avi and mov (yes this is ugly ...) if (context->buffer) { int i; @@ -175,9 +178,6 @@ static int raw_decode(AVCodecContext *avctx, avctx->codec_tag == MKTAG('A', 'V', 'u', 'p')) buf += buf_size - context->length; - if(buf_size < context->length - (avctx->pix_fmt==PIX_FMT_PAL8 ? 256*4 : 0)) - return -1; - avpicture_fill(picture, buf, avctx->pix_fmt, avctx->width, avctx->height); if((avctx->pix_fmt==PIX_FMT_PAL8 && buf_size < context->length) || (avctx->pix_fmt!=PIX_FMT_PAL8 && |