From 4d0203aa830a6dfabb163514a5a8cd5b5b7bd86e Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Wed, 19 Feb 2020 15:09:38 +0000 Subject: [PATCH] glsl/list: use uintptr_t for exec_node_data()'s subtraction This fixes UBSan warnings when foreach_list_typed_safe() passes NULL: pointer index expression with base 0x000000000000 overflowed to 0xffffffffffffffa8 Signed-off-by: Rhys Perry Reviewed-by: Matt Turner Tested-by: Marge Bot Part-of: --- src/compiler/glsl/list.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/glsl/list.h b/src/compiler/glsl/list.h index ed77dcfab41..c80f776ae16 100644 --- a/src/compiler/glsl/list.h +++ b/src/compiler/glsl/list.h @@ -281,7 +281,7 @@ inline bool exec_node::is_head_sentinel() const * \param field Name of the field in \c type that is the embedded \c exec_node */ #define exec_node_data(type, node, field) \ - ((type *) (((char *) node) - exec_list_offsetof(type, field, node))) + ((type *) (((uintptr_t) node) - exec_list_offsetof(type, field, node))) #ifdef __cplusplus struct exec_node; -- 2.30.2