mirror of
https://github.com/verilator/verilator.git
synced 2025-02-08 14:41:48 +00:00
vpi_get_value_array: added out of bonds check.
Signed-off-by: Diego Roux <diegoroux04@protonmail.com>
This commit is contained in:
parent
c800c7294e
commit
f57687f3ab
@ -3359,6 +3359,14 @@ void vpi_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p,
|
|||||||
__func__, vop->fullname(), varp->dims());
|
__func__, vop->fullname(), varp->dims());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int minRange = fmin(vop->rangep()->left(), vop->rangep()->right());
|
||||||
|
int maxRange = fmax(vop->rangep()->left(), vop->rangep()->right());
|
||||||
|
|
||||||
|
if ((index_p[0] > maxRange) || (index_p[0] < minRange)) {
|
||||||
|
VL_VPI_ERROR_(__FILE__, __LINE__, "%s: index %u for object %s is out of bounds [%u,%u]",
|
||||||
|
__func__, index_p[0], vop->fullname(), minRange, maxRange);
|
||||||
|
}
|
||||||
|
|
||||||
vl_get_value_array(object, arrayvalue_p, index_p, num);
|
vl_get_value_array(object, arrayvalue_p, index_p, num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user