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 <pendingchaos02@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4157> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4157>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user