From 5b810bac5e2e91f444dddd83214dec363e16261a Mon Sep 17 00:00:00 2001 From: Nathan Kidd Date: Wed, 7 Aug 2024 18:17:32 -0400 Subject: [PATCH] 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 Part-of: --- glx/singlesize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glx/singlesize.c b/glx/singlesize.c index 344ffef7f..d2db6945a 100644 --- a/glx/singlesize.c +++ b/glx/singlesize.c @@ -105,7 +105,7 @@ __glGetMap_size(GLenum target, GLenum query) } break; } - return -1; + return 0; } GLint @@ -164,7 +164,7 @@ __glGetPixelMap_size(GLenum map) query = GL_PIXEL_MAP_A_TO_A_SIZE; break; default: - return -1; + return 0; } glGetIntegerv(query, &size); return size;