diff options
| author | Robert Norton | 2017-03-30 14:38:13 +0100 |
|---|---|---|
| committer | Robert Norton | 2017-03-30 14:55:09 +0100 |
| commit | 57ff1667d971c7ab748a67a36953dab8c0838142 (patch) | |
| tree | 2e67c5fd20b21ac97437f70600ccc6f5312bef9a | |
| parent | 898a292944aa1b6ce40b146f2bc1b48d57b9dcc7 (diff) | |
Fix to csetboundsexact (was untested, same fix previously applied to csetbounds but not here).
| -rw-r--r-- | cheri/cheri_insts.sail | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cheri/cheri_insts.sail b/cheri/cheri_insts.sail index e40e684a..e1c1cc00 100644 --- a/cheri/cheri_insts.sail +++ b/cheri/cheri_insts.sail @@ -415,6 +415,7 @@ function clause execute (CSetBoundsExact(cd, cb, rt)) = cursor := getCapCursor(cb_val); base := getCapBase(cb_val); top := getCapTop(cb_val); + newTop := cursor + rt_val; if (register_inaccessible(cd)) then raise_c2_exception(CapEx_AccessSystemRegsViolation, cd) else if (register_inaccessible(cb)) then @@ -425,10 +426,10 @@ function clause execute (CSetBoundsExact(cd, cb, rt)) = raise_c2_exception(CapEx_SealViolation, cb) else if (cursor < base) then raise_c2_exception(CapEx_LengthViolation, cb) - else if ((cursor + rt_val) > top) then + else if (newTop > top) then raise_c2_exception(CapEx_LengthViolation, cb) else - let (exact, newCap) = setCapBounds(cb_val, (bit[64]) base, (bit[65]) top) in + let (exact, newCap) = setCapBounds(cb_val, (bit[64]) cursor, (bit[65]) newTop) in if not (exact) then raise_c2_exception(CapEx_InexactBounds, cb) else |
