Fix screen number checks.
screenInfo.numScreens is not a valid screen number, they go from 0 to numScreens - 1. Signed-off-by: Cyril Brulebois <kibi@debian.org> Reviewed-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
committed by
Keith Packard
parent
8684543021
commit
279ef1ffd7
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user