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