On 4 January 2012 07:27, John Brooks <[email protected]> wrote:
> For small video dimensions, these calculations of the upper bound
> for pixel access may have a negative result. Using an unsigned
> comparison to bound a potentially negative value only works if
> the greater operand is non-negative. Fixed by doing edge emulation
> when the upper bound is probably negative, everywhere that this
> pattern appears.
> ---
>  libavcodec/snow.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/snow.c b/libavcodec/snow.c
> index 905e02a..ffbc6b9 100644
> --- a/libavcodec/snow.c
> +++ b/libavcodec/snow.c
> @@ -337,8 +337,9 @@ void ff_snow_pred_block(SnowContext *s, uint8_t *dst, 
> uint8_t *tmp, int stride,
>         sx += (mx>>4) - (HTAPS_MAX/2-1);
>         sy += (my>>4) - (HTAPS_MAX/2-1);
>         src += sx + sy*stride;
> -        if(   (unsigned)sx >= w - b_w - (HTAPS_MAX-2)
> -           || (unsigned)sy >= h - b_h - (HTAPS_MAX-2)){
> +        if(w - b_w < HTAPS_MAX - 2 || h - b_h < HTAPS_MAX - 2 ||
> +           (unsigned)sx >= w - b_w - (HTAPS_MAX-2) ||
> +           (unsigned)sy >= h - b_h - (HTAPS_MAX-2)) {
>             s->dsp.emulated_edge_mc(tmp + MB_SIZE, src, stride, 
> b_w+HTAPS_MAX-1, b_h+HTAPS_MAX-1, sx, sy, w, h);
>             src= tmp + MB_SIZE;
>         }
> --

LGTM
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to