MCPcopy Create free account
hub / github.com/PerroEngine/Perro / checked_entry_range

Function checked_entry_range

perro_source/io_stack/perro_assets/src/archive.rs:189–204  ·  view source on GitHub ↗
(data_len: usize, entry: &PerroAssetsEntry)

Source from the content-addressed store, hash-verified

187 "Compressed PerroAssets size mismatch: expected {}, got {}",
188 original_size,
189 out.len()
190 ),
191 ));
192 }
193 Ok(std::mem::take(&mut out))
194}
195
196fn checked_decompressed_size(size: u64) -> io::Result<usize> {
197 let size = usize::try_from(size)
198 .map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "archive entry too large"))?;
199 if size > MAX_DECOMPRESSED_ARCHIVE_BYTES {
200 return Err(io::Error::new(
201 io::ErrorKind::InvalidData,
202 "archive entry exceeds decompression limit",
203 ));
204 }
205 Ok(size)
206}
207

Callers 4

read_fileMethod · 0.85
get_file_sliceMethod · 0.85
stream_fileMethod · 0.85
readMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected