[libav-devel] [PATCH 02/27] shorten: Prevent block size from increasing

Kostya Shishkov kostya.shishkov at gmail.com
Fri Oct 7 15:42:11 CEST 2011


On Fri, Oct 07, 2011 at 03:26:01PM +0200, Janne Grunau wrote:
> From: Laurent Aimar <fenrir at elivagar.org>
> 
> Signed-off-by: Janne Grunau <janne-libav at jannau.net>
> ---
>  libavcodec/shorten.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
> index 80b1b4d..8f7436e 100644
> --- a/libavcodec/shorten.c
> +++ b/libavcodec/shorten.c
> @@ -482,9 +482,15 @@ static int shorten_decode_frame(AVCodecContext *avctx,
>              case FN_BITSHIFT:
>                  s->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE);
>                  break;
> -            case FN_BLOCKSIZE:
> -                s->blocksize = get_uint(s, av_log2(s->blocksize));
> +            case FN_BLOCKSIZE: {
> +                int blocksize = get_uint(s, av_log2(s->blocksize));
> +                if (blocksize > s->blocksize) {
> +                    av_log(avctx, AV_LOG_ERROR, "Increasing block size is not supported\n");
> +                    return AVERROR_PATCHWELCOME;
> +                }
> +                s->blocksize = blocksize;
>                  break;
> +            }
>              case FN_QUIT:
>                  *data_size = 0;
>                  return buf_size;
> -- 

looks OK


More information about the libav-devel mailing list