Skip to content

Commit 7ff0e29

Browse files
authored
[move compiler] address nits (#18092)
1 parent 6189316 commit 7ff0e29

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

third_party/move/move-bytecode-verifier/src/reference_safety/abstract_state.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,16 @@ impl AbstractState {
466466
mut_: bool,
467467
) -> PartialVMResult<AbstractValue> {
468468
let vec_id = safe_unwrap!(vector.ref_id());
469+
470+
// For immutable borrow, check that the vector is readable
471+
if !mut_ && !self.is_readable(vec_id, None) {
472+
return Err(self.error(
473+
StatusCode::VEC_BORROW_ELEMENT_EXISTS_MUTABLE_BORROW_ERROR,
474+
offset,
475+
));
476+
}
477+
478+
// For mutable borrow, check that the vector is writable
469479
if mut_ && !self.is_writable(vec_id) {
470480
return Err(self.error(
471481
StatusCode::VEC_BORROW_ELEMENT_EXISTS_MUTABLE_BORROW_ERROR,

0 commit comments

Comments
 (0)