[FFmpeg-devel] [PATCH 1/6] libopenjpegenc: Replace numcomps check in libopenjpeg_copy_rgba() by assert() as it cannot be a different value.

Michael Bradshaw mbradshaw at sorensonmedia.com
Fri Nov 18 22:55:45 CET 2011


On Thu, Nov 17, 2011 at 6:32 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  libavcodec/libopenjpegenc.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
> index 737cd58..1a92d60 100644
> --- a/libavcodec/libopenjpegenc.c
> +++ b/libavcodec/libopenjpegenc.c
> @@ -25,6 +25,7 @@
>  */
>
>  #include "libavutil/imgutils.h"
> +#include "libavutil/avassert.h"
>  #include "avcodec.h"
>  #include "libavutil/intreadwrite.h"
>  #define  OPJ_STATIC
> @@ -186,9 +187,7 @@ static int libopenjpeg_copy_rgba(AVCodecContext *avctx, AVFrame *frame, opj_imag
>     int x;
>     int y;
>
> -    if (numcomps != 1 && numcomps != 3 && numcomps != 4) {
> -        return 0;
> -    }
> +    av_assert0(numcomps == 1 || numcomps == 3 || numcomps == 4);
>
>     for (compno = 0; compno < numcomps; ++compno) {
>         if (image->comps[compno].w > frame->linesize[0] / numcomps) {
> --
> 1.7.4.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Applied.


More information about the ffmpeg-devel mailing list