glsl: fix downcasting addresses to wrong object types
This fixes several downcasting of address to object types when the original object types were either different or invalid. This has been detected throught Undefined Behaviour Sanitizer (UBSan). An example of such issue were: `downcast of address 0x55559c0cbcc0 which does not point to an object of type 'ir_variable' 0x55559c0cbcc0: note: object is of type 'ir_constant' Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29772>
This commit is contained in:
committed by
Marge Bot
parent
60e7cb7654
commit
ee1ced9dc5
@@ -303,7 +303,8 @@ dead_code_local_basic_block(ir_instruction *first,
|
||||
ir_instruction *last,
|
||||
void *data)
|
||||
{
|
||||
ir_instruction *ir, *ir_next;
|
||||
ir_instruction *ir;
|
||||
exec_node *node, *node_next;
|
||||
/* List of avaialble_copy */
|
||||
exec_list assignments;
|
||||
bool *out_progress = (bool *)data;
|
||||
@@ -313,8 +314,9 @@ dead_code_local_basic_block(ir_instruction *first,
|
||||
linear_ctx *lin_ctx = linear_context(ctx);
|
||||
|
||||
/* Safe looping, since process_assignment */
|
||||
for (ir = first, ir_next = (ir_instruction *)first->next;;
|
||||
ir = ir_next, ir_next = (ir_instruction *)ir->next) {
|
||||
for (node = first, node_next = first->next;;
|
||||
node = node_next, node_next = node->next) {
|
||||
ir = (ir_instruction *) node;
|
||||
ir_assignment *ir_assign = ir->as_assignment();
|
||||
|
||||
if (debug) {
|
||||
|
||||
Reference in New Issue
Block a user