lang: ast: fix nullptr deref in expr_finalise_arith when calculating ast node bounds
This commit is contained in:
@@ -379,19 +379,29 @@ enum ivy_status expr_finalise_arith(
|
||||
op = op_node->n_op;
|
||||
tmp = b_queue_pop_back(&q);
|
||||
op_node->n_right = b_unbox(struct ivy_ast_node, tmp, n_entry);
|
||||
|
||||
if (op_node->n_right) {
|
||||
op_node->n_right->n_parent = (struct ivy_ast_node *)op_node;
|
||||
|
||||
ivy_ast_node_extend_bounds_recursive(
|
||||
(struct ivy_ast_node *)op_node, (struct ivy_ast_node *)tmp);
|
||||
(struct ivy_ast_node *)op_node,
|
||||
(struct ivy_ast_node *)tmp);
|
||||
}
|
||||
|
||||
if (op->op_arity == IVY_OP_BINARY) {
|
||||
tmp = b_queue_pop_back(&q);
|
||||
op_node->n_left
|
||||
= b_unbox(struct ivy_ast_node, tmp, n_entry);
|
||||
op_node->n_left->n_parent = (struct ivy_ast_node *)op_node;
|
||||
|
||||
if (op_node->n_left) {
|
||||
op_node->n_left->n_parent
|
||||
= (struct ivy_ast_node *)op_node;
|
||||
|
||||
ivy_ast_node_extend_bounds_recursive(
|
||||
(struct ivy_ast_node *)op_node,
|
||||
(struct ivy_ast_node *)tmp);
|
||||
}
|
||||
}
|
||||
|
||||
/* ...and push the newly-completed operator node to the operand
|
||||
* queue */
|
||||
|
||||
Reference in New Issue
Block a user