mirror of
https://github.com/verilator/verilator.git
synced 2026-10-05 17:43:31 +02:00
Internals: resolved incorrect array bounds guarding (#8224)
Co-authored-by: Sumanth Kadiyala <[email protected]>
This commit is contained in:
co-authored by
Sumanth Kadiyala
parent
d04647f459
commit
3990376c57
@@ -1438,8 +1438,8 @@ inline void _vl_insert_WI(WDataOutP iowp, IData ld, int hbit, int lbit, int rbit
|
||||
const int nbitsonright = VL_EDATASIZE - loffset; // bits that end up in lword
|
||||
iowp[lword] = (iowp[lword] & ~linsmask) | ((lde << loffset) & linsmask);
|
||||
// Prevent unsafe write where lword was final writable location and hword is
|
||||
// out-of-bounds.
|
||||
if (VL_LIKELY(!(hword == rword && roffset == 0))) {
|
||||
// out-of-bounds. rbits==0 means the caller guarantees bounds.
|
||||
if (VL_LIKELY(!(rbits && hword >= VL_WORDS_I(rbits)))) {
|
||||
iowp[hword]
|
||||
= (iowp[hword] & ~hinsmask) | ((lde >> nbitsonright) & (hinsmask & cleanmask));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user