(script: &'a CompiledScript)
| 31 | |
| 32 | impl<'a> BoundsChecker<'a> { |
| 33 | pub fn verify_script(script: &'a CompiledScript) -> PartialVMResult<()> { |
| 34 | let mut bounds_check = Self { |
| 35 | view: BinaryIndexedView::Script(script), |
| 36 | context: BoundsCheckingContext::Script, |
| 37 | }; |
| 38 | bounds_check.verify_impl()?; |
| 39 | |
| 40 | let type_param_count = script.type_parameters.len(); |
| 41 | |
| 42 | check_bounds_impl(bounds_check.view.signatures(), script.parameters)?; |
| 43 | if let Some(sig) = bounds_check |
| 44 | .view |
| 45 | .signatures() |
| 46 | .get(script.parameters.into_index()) |
| 47 | { |
| 48 | for ty in &sig.0 { |
| 49 | bounds_check.check_type_parameter(ty, type_param_count)? |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | // The bounds checker has already checked each function definition's code, but a |
| 54 | // script's code exists outside of any function definition. It gets checked here. |
| 55 | bounds_check.check_code( |
| 56 | &script.code, |
| 57 | &script.type_parameters, |
| 58 | bounds_check |
| 59 | .view |
| 60 | .signatures() |
| 61 | .get(script.parameters.into_index()) |
| 62 | .unwrap(), |
| 63 | ) |
| 64 | } |
| 65 | |
| 66 | pub fn verify_module(module: &'a CompiledModule) -> PartialVMResult<()> { |
| 67 | let mut bounds_check = Self { |
nothing calls this directly
no test coverage detected