mesa: check for enabled extensions for *UID enums
Applications might use them without checking if the extension is supported and would run into a NULL pointer deref calling the callbacks. Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30455>
This commit is contained in:
@@ -2908,20 +2908,28 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
|
||||
|
||||
/* GL_EXT_external_objects */
|
||||
case GL_NUM_DEVICE_UUIDS_EXT:
|
||||
if (!ctx->Extensions.EXT_memory_object && !ctx->Extensions.EXT_semaphore)
|
||||
goto invalid_enum;
|
||||
v->value_int = 1;
|
||||
return TYPE_INT;
|
||||
case GL_DRIVER_UUID_EXT:
|
||||
if (!ctx->Extensions.EXT_memory_object && !ctx->Extensions.EXT_semaphore)
|
||||
goto invalid_enum;
|
||||
if (index >= 1)
|
||||
goto invalid_value;
|
||||
_mesa_get_driver_uuid(ctx, v->value_int_4);
|
||||
return TYPE_INT_4;
|
||||
case GL_DEVICE_UUID_EXT:
|
||||
if (!ctx->Extensions.EXT_memory_object && !ctx->Extensions.EXT_semaphore)
|
||||
goto invalid_enum;
|
||||
if (index >= 1)
|
||||
goto invalid_value;
|
||||
_mesa_get_device_uuid(ctx, v->value_int_4);
|
||||
return TYPE_INT_4;
|
||||
/* GL_EXT_memory_object_win32 */
|
||||
case GL_DEVICE_LUID_EXT:
|
||||
if (!ctx->Extensions.EXT_memory_object_win32 && !ctx->Extensions.EXT_semaphore_win32)
|
||||
goto invalid_enum;
|
||||
if (index >= 1)
|
||||
goto invalid_value;
|
||||
_mesa_get_device_luid(ctx, v->value_int_2);
|
||||
|
Reference in New Issue
Block a user