[FFmpeg-devel] [PATCH] vf_pad: avoid buffer overflow in buffer_needs_copy()

Stefano Sabatini stefasab at gmail.com
Sun Mar 10 10:56:40 CET 2013


On date Saturday 2013-03-09 22:39:32 -0500, Xi Wang encoded:
> Replace & with short-circuit &&.
> 
> Signed-off-by: Xi Wang <xi.wang at gmail.com>
> ---
>  libavfilter/vf_pad.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
> index 86fd683..3f4a4f0 100644
> --- a/libavfilter/vf_pad.c
> +++ b/libavfilter/vf_pad.c
> @@ -300,7 +300,7 @@ static int buffer_needs_copy(PadContext *s, AVFrame *frame, AVBufferRef *buf)
>              return 1;
>  
>  #define SIGN(x) ((x) > 0 ? 1 : -1)
> -        for (j = 0; j < FF_ARRAY_ELEMS(planes) & planes[j] >= 0; j++) {
> +        for (j = 0; j < FF_ARRAY_ELEMS(planes) && planes[j] >= 0; j++) {
>              int hsub1 = s->draw.hsub[planes[j]];
>              uint8_t *start1 = frame->data[planes[j]];
>              uint8_t *end1   = start1 + (frame->height >> hsub1) *
> -- 
> 1.7.10.4

Applied, thanks.
-- 
FFmpeg = Free & Fast Mastering Plastic Exxagerate Gnome


More information about the ffmpeg-devel mailing list