pub struct DecodeLimits {
pub max_frame_bytes: usize,
pub max_string_bytes: usize,
pub max_blob_bytes: usize,
pub max_table_entries: usize,
pub max_expr_nodes: usize,
pub max_depth: usize,
pub max_trivia_items: usize,
}Expand description
Fail-closed bounds applied while decoding an untrusted bitwise frame.
Every count and length read from a frame is checked against these limits
before any allocation, so a malformed or hostile frame cannot exhaust
memory or recurse without bound. Construct via DecodeLimits::default or
from the shared sim_codec::DecodeLimits (see the From impl).
Fields§
§max_frame_bytes: usizeMaximum total size, in bytes, of the frame accepted by the reader.
max_string_bytes: usizeMaximum length, in bytes, of any single decoded string.
max_blob_bytes: usizeMaximum length, in bytes, of any single decoded byte blob.
max_table_entries: usizeMaximum number of entries in any side table or collection.
max_expr_nodes: usizeMaximum number of Expr nodes decoded from one frame.
max_depth: usizeMaximum nesting depth of the decoded Expr graph.
max_trivia_items: usizeMaximum number of trivia items carried by a single origin.
Trait Implementations§
Source§impl Clone for DecodeLimits
impl Clone for DecodeLimits
Source§fn clone(&self) -> DecodeLimits
fn clone(&self) -> DecodeLimits
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for DecodeLimits
Source§impl Debug for DecodeLimits
impl Debug for DecodeLimits
Source§impl Default for DecodeLimits
impl Default for DecodeLimits
impl Eq for DecodeLimits
Source§impl From<DecodeLimits> for DecodeLimits
impl From<DecodeLimits> for DecodeLimits
Source§fn from(shared: SharedDecodeLimits) -> Self
fn from(shared: SharedDecodeLimits) -> Self
Converts to this type from the input type.
Source§impl PartialEq for DecodeLimits
impl PartialEq for DecodeLimits
Source§fn eq(&self, other: &DecodeLimits) -> bool
fn eq(&self, other: &DecodeLimits) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for DecodeLimits
Auto Trait Implementations§
impl Freeze for DecodeLimits
impl RefUnwindSafe for DecodeLimits
impl Send for DecodeLimits
impl Sync for DecodeLimits
impl Unpin for DecodeLimits
impl UnsafeUnpin for DecodeLimits
impl UnwindSafe for DecodeLimits
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more