pub enum LimitError {
FileTooLarge {
actual_bytes: u64,
limit_bytes: u64,
},
StreamTooLarge {
actual_bytes: u64,
limit_bytes: u64,
},
ImageTooLarge {
width: u64,
height: u64,
pixels: u64,
limit_pixels: u64,
},
ObjectDepthExceeded {
depth: u32,
limit: u32,
},
TooManyOperators {
count: u64,
limit: u64,
},
XfaNestingTooDeep {
depth: u32,
limit: u32,
},
FormCalcRecursionTooDeep {
depth: u32,
limit: u32,
},
}Expand description
Error returned when a configured resource limit is exceeded.
A LimitError is a hard stop on the current operation — the caller
should either raise the relevant cap on the ProcessingLimits used
to construct the engine, or refuse the input. All variants carry both
the observed value and the limit so callers can produce useful error
messages without re-running detection.
Variants§
FileTooLarge
PDF file size exceeded ProcessingLimits::max_file_bytes.
Defends against trivially-DoS-ing the parser with an oversized
input.
Fields
StreamTooLarge
A decompressed stream exceeded
ProcessingLimits::max_stream_bytes. Defends against
“decompression bomb” inputs (Flate, LZW, ASCII85) that expand
far beyond their compressed footprint.
Fields
ImageTooLarge
An image XObject exceeded ProcessingLimits::max_image_pixels.
pixels = width * height regardless of color depth. Guards the
memory used by rasterization and color-space conversion.
Fields
ObjectDepthExceeded
Indirect-object reference chain exceeded
ProcessingLimits::max_object_depth. Defends against cyclic or
pathologically nested object graphs that would otherwise blow
the parser stack.
Fields
TooManyOperators
Content-stream operator count exceeded
ProcessingLimits::max_operator_count. Caps per-page
rendering work so a billion no-op operators can’t pin a CPU.
XfaNestingTooDeep
XFA template subform nesting exceeded
ProcessingLimits::max_xfa_nesting_depth. Defends the XFA
layout engine against pathologically nested templates.
FormCalcRecursionTooDeep
FormCalc expression recursion exceeded
ProcessingLimits::max_formcalc_depth. Stops infinite or
deeply mutually-recursive expressions from blowing the FormCalc
interpreter stack.
Trait Implementations§
Source§impl Clone for LimitError
impl Clone for LimitError
Source§fn clone(&self) -> LimitError
fn clone(&self) -> LimitError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LimitError
impl Debug for LimitError
Source§impl Display for LimitError
impl Display for LimitError
Source§impl Error for LimitError
impl Error for LimitError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for LimitError
impl PartialEq for LimitError
Source§fn eq(&self, other: &LimitError) -> bool
fn eq(&self, other: &LimitError) -> bool
self and other values to be equal, and is used by ==.impl Eq for LimitError
impl StructuralPartialEq for LimitError
Auto Trait Implementations§
impl Freeze for LimitError
impl RefUnwindSafe for LimitError
impl Send for LimitError
impl Sync for LimitError
impl Unpin for LimitError
impl UnsafeUnpin for LimitError
impl UnwindSafe for LimitError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.