aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRhys Perry <[email protected]>2020-02-19 15:09:38 +0000
committerMarge Bot <[email protected]>2020-03-12 12:09:07 +0000
commit4d0203aa830a6dfabb163514a5a8cd5b5b7bd86e (patch)
treecad0f1d60d45cfd38f492d3f62047d3d88d3ffdc /src
parent85d05b3fd713d67aa764dff60467a896a7aa1011 (diff)
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 <[email protected]> Reviewed-by: Matt Turner <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4157> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4157>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/glsl/list.h2
1 files changed, 1 insertions, 1 deletions
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;