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§impl Debug for LimitError
impl Debug for LimitError
Source§impl Display for LimitError
impl Display for LimitError
impl Eq 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
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
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
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 more