glx: Fix out-of-bounds reads from negative return

The callers of these functions were casting -1 to unsigned and then
using 4GB indexes. By returning 0 we match all the other size functions.

GLX size functions return -1 to indicate error, but GL size functions return 0.

Signed-off-by: Nathan Kidd <nkidd@rocketsoftware.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1647>
This commit is contained in:
Nathan Kidd 2024-08-07 18:17:32 -04:00 committed by Enrico Weigelt
parent 7c64a06ba4
commit 5b810bac5e

View File

@ -105,7 +105,7 @@ __glGetMap_size(GLenum target, GLenum query)
} }
break; break;
} }
return -1; return 0;
} }
GLint GLint
@ -164,7 +164,7 @@ __glGetPixelMap_size(GLenum map)
query = GL_PIXEL_MAP_A_TO_A_SIZE; query = GL_PIXEL_MAP_A_TO_A_SIZE;
break; break;
default: default:
return -1; return 0;
} }
glGetIntegerv(query, &size); glGetIntegerv(query, &size);
return size; return size;