MCPcopy Create free account
hub / github.com/diem/move / check_code_unit_bounds_impl

Method check_code_unit_bounds_impl

language/move-binary-format/src/check_bounds.rs:615–637  ·  view source on GitHub ↗
(
        &self,
        pool: &[T],
        idx: I,
        bytecode_offset: usize,
    )

Source from the content-addressed store, hash-verified

613 }
614
615 fn check_code_unit_bounds_impl<T, I>(
616 &self,
617 pool: &[T],
618 idx: I,
619 bytecode_offset: usize,
620 ) -> PartialVMResult<()>
621 where
622 I: ModuleIndex,
623 {
624 let idx = idx.into_index();
625 let len = pool.len();
626 if idx >= len {
627 Err(self.offset_out_of_bounds(
628 StatusCode::INDEX_OUT_OF_BOUNDS,
629 I::KIND,
630 idx,
631 len,
632 bytecode_offset as CodeOffset,
633 ))
634 } else {
635 Ok(())
636 }
637 }
638
639 fn get_locals(&self, code_unit: &CodeUnit) -> PartialVMResult<&[SignatureToken]> {
640 match self.view.signatures().get(code_unit.locals.into_index()) {

Callers 2

check_codeMethod · 0.80

Calls 2

offset_out_of_boundsMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected