Handle invalid vector slice base expressions
The elaboration of the base expression of a vector slice index can fail and return a nullptr. Currently this results in a nullptr deref. Handle that case by exiting the function early. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
bc119f96a9
commit
e7e663056a
|
|
@ -5994,6 +5994,8 @@ NetExpr* PEIdent::elaborate_expr_net_idx_up_(Design*des, NetScope*scope,
|
|||
return 0;
|
||||
|
||||
NetExpr*base = calculate_up_do_base_(des, scope, need_const);
|
||||
if (!base)
|
||||
return nullptr;
|
||||
|
||||
// Use the part select width already calculated by test_width().
|
||||
unsigned long wid = min_width_;
|
||||
|
|
@ -6141,6 +6143,8 @@ NetExpr* PEIdent::elaborate_expr_net_idx_do_(Design*des, NetScope*scope,
|
|||
return 0;
|
||||
|
||||
NetExpr*base = calculate_up_do_base_(des, scope, need_const);
|
||||
if (!base)
|
||||
return nullptr;
|
||||
|
||||
// Use the part select width already calculated by test_width().
|
||||
unsigned long wid = min_width_;
|
||||
|
|
|
|||
Loading…
Reference in New Issue