[PATCH] Fix screen number checks.

Alex Deucher alexdeucher at gmail.com
Wed Dec 1 07:29:01 PST 2010


On Wed, Dec 1, 2010 at 8:12 AM, Cyril Brulebois <kibi at debian.org> wrote:
> screenInfo.numScreens is not a valid screen number, they go from 0 to
> numScreens - 1.
>
> Signed-off-by: Cyril Brulebois <kibi at debian.org>

Reviewed-by: Alex Deucher <alexdeucher at gmail.com>

> ---
>  hw/dmx/glxProxy/glxcmds.c     |    6 +++---
>  hw/dmx/glxProxy/glxcmdsswap.c |    2 +-
>  hw/kdrive/ephyr/ephyrdriext.c |    2 +-
>  3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
> index 7602128..6a0aae7 100644
> --- a/hw/dmx/glxProxy/glxcmds.c
> +++ b/hw/dmx/glxProxy/glxcmds.c
> @@ -1531,7 +1531,7 @@ int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
>     int i, p;
>
>     screen = req->screen;
> -    if (screen > screenInfo.numScreens) {
> +    if (screen >= screenInfo.numScreens) {
>        /* The client library must send a valid screen number. */
>        client->errorValue = screen;
>        return BadValue;
> @@ -2680,7 +2680,7 @@ int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
>     int numFBConfigs, i, p;
>     __GLXscreenInfo *pGlxScreen;
>
> -    if (screen > screenInfo.numScreens) {
> +    if (screen >= screenInfo.numScreens) {
>        /* The client library must send a valid screen number. */
>        client->errorValue = screen;
>        return BadValue;
> @@ -3102,7 +3102,7 @@ int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
>    /*
>     ** Look up screen and FBConfig.
>     */
> -    if (screen > screenInfo.numScreens) {
> +    if (screen >= screenInfo.numScreens) {
>         /* The client library must send a valid screen number. */
>         client->errorValue = screen;
>         return BadValue;
> diff --git a/hw/dmx/glxProxy/glxcmdsswap.c b/hw/dmx/glxProxy/glxcmdsswap.c
> index 44f1c15..2294059 100644
> --- a/hw/dmx/glxProxy/glxcmdsswap.c
> +++ b/hw/dmx/glxProxy/glxcmdsswap.c
> @@ -252,7 +252,7 @@ int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
>
>     __GLX_SWAP_INT(&req->screen);
>     screen = req->screen;
> -    if (screen > screenInfo.numScreens) {
> +    if (screen >= screenInfo.numScreens) {
>        /* The client library must send a valid screen number. */
>        client->errorValue = screen;
>        return BadValue;
> diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
> index 8874a43..6945f5b 100644
> --- a/hw/kdrive/ephyr/ephyrdriext.c
> +++ b/hw/kdrive/ephyr/ephyrdriext.c
> @@ -398,7 +398,7 @@ EphyrDuplicateVisual (unsigned int a_screen,
>     int i=0 ;
>
>     EPHYR_LOG ("enter\n") ;
> -    if (a_screen > screenInfo.numScreens) {
> +    if (a_screen >= screenInfo.numScreens) {
>         EPHYR_LOG_ERROR ("bad screen number\n") ;
>         goto out;
>     }
> --
> 1.7.2.3
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>


More information about the xorg-devel mailing list