Reject a length value that exceeds `cap`. Used everywhere a `usize` length is decoded from segment bytes.
(value: usize, cap: usize, what: &str)
| 43 | /// Reject a length value that exceeds `cap`. Used everywhere a `usize` |
| 44 | /// length is decoded from segment bytes. |
| 45 | pub fn check_decoded_size(value: usize, cap: usize, what: &str) -> ArrayResult<()> { |
| 46 | if value > cap { |
| 47 | return Err(ArrayError::SegmentCorruption { |
| 48 | detail: format!( |
| 49 | "decoded {what} = {value} exceeds hard cap {cap} (segment likely corrupt)" |
| 50 | ), |
| 51 | }); |
| 52 | } |
| 53 | Ok(()) |
| 54 | } |
no outgoing calls
no test coverage detected