This was found when compiling for aarch64 (PowerPC):

../../src/smi_video.c: In function 'SMI_ResetVideo':
../../src/smi_video.c:686:45: error: array subscript is above array bounds
[-Werror=array-bounds]
 value = CLAMP(value, SMI_VideoAttributes[i].min_value,

I'm not sure why the other architectures don't pick this up.

--Robert

On Wed, Sep 30, 2015 at 5:02 PM Robert Ancell <[email protected]>
wrote:

> The array has only two elements but the clamping code was assuming it
> contained
> all the elements in order. This means no clamping is now done but at least
> it
> wont read off the end of the array.
>
> Signed-off-by: Robert Ancell <[email protected]>
> ---
>  src/smi_video.c | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/src/smi_video.c b/src/smi_video.c
> index 27df68d..a13668e 100644
> --- a/src/smi_video.c
> +++ b/src/smi_video.c
> @@ -681,10 +681,6 @@ SetAttr(ScrnInfoPtr pScrn, int i, int value)
>
>      if (i < XV_ENCODING || i > XV_HUE)
>         return BadMatch;
> -
> -    /* clamps value to attribute range */
> -    value = CLAMP(value, SMI_VideoAttributes[i].min_value,
> -                 SMI_VideoAttributes[i].max_value);
>
>      if (i == XV_BRIGHTNESS) {
>         int my_value = (value <= 128? value + 128 : value - 128);
> --
> 2.5.0
>
>
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to