On Mon, Mar 31, 2014 at 06:58:25PM +0530, Sayanti Bandyopadhyay wrote:
> I am sending patch for checking allocated memory &
> fixing return Value in libavcodec/vp56.c
> I am seding the link and attching the code.
> http://codetidy.com/8681/
Actually, you sent a complete file, not a patch.
> --- src/libav/libavcodec/vp56.c 2014-03-11 20:42:48.068285696 +0100
> +++ /tmp/vp56.c 2014-03-31 19:23:25.500653304 +0200
> @@ -473,13 +473,18 @@
> if (s->mb_width > 1000 || s->mb_height > 1000) {
> ff_set_dimensions(avctx, 0, 0);
> av_log(avctx, AV_LOG_ERROR, "picture too big\n");
> - return -1;
> + return AVERROR(EFBIG);
EFBIG is not the right error code here, INVALIDDATA is. The file is not
too big, the dimensions of the image coded within that file are.
Also, you add a tab, but we indent with spaces only, same below.
> s->above_blocks = av_realloc(s->above_blocks,
> (4*s->mb_width+6) *
> sizeof(*s->above_blocks));
> s->macroblocks = av_realloc(s->macroblocks,
>
> s->mb_width*s->mb_height*sizeof(*s->macroblocks));
> + if (!s->above_blocks || s->macroblocks)
> + {
> + return AVERROR(ENOMEM);
> + }
We drop {} for single-line statements and otherwise place them on the
same line as the if.
> @@ -664,9 +669,9 @@
> ff_vp3dsp_init(&s->vp3dsp, avctx->flags);
> ff_vp56dsp_init(&s->vp56dsp, avctx->codec->id);
> for (i = 0; i < 64; i++) {
> -#define TRANSPOSE(x) (x >> 3) | ((x & 7) << 3)
> - s->idct_scantable[i] = TRANSPOSE(ff_zigzag_direct[i]);
> -#undef TRANSPOSE
> +#define T(x) (x >> 3) | ((x & 7) << 3)
> + s->idct_scantable[i] = T(ff_zigzag_direct[i]);
> +#undef T
> }
This is a stray change. It seems like you are working with an outdated
version of that file.
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel