Table of Contents

Class PdfSecurityLimits

Namespace
PdfEngine.Vector.Limits
Assembly
PdfEngine.Vector.dll

Hard ceilings and defensive limits for parsing untrusted hostile PDF data. Protects against decompression bombs, cyclic object references, infinite recursion, and OOM.

public sealed class PdfSecurityLimits
Inheritance
PdfSecurityLimits
Inherited Members

Fields

Default

The default limits. Create an instance with init values to change some of them.

public static readonly PdfSecurityLimits Default

Field Value

PdfSecurityLimits

MaxRenderPixelCount

Ceiling on the pixel count of one render buffer, shared by every raster backend (Direct2D, WPF, Skia). Past it the stride x height product (4 bytes a pixel) leaves int range, so a page whose MediaBox, UserUnit or requested resolution asks for more is refused with a PdfResourceLimitException whose LimitName is "MaxRenderPixelCount", before any buffer is allocated. Far above any real viewport or export; zoomed-in views render regions. A constant, not a setting: the buffer size cannot go past it.

public const long MaxRenderPixelCount = 536870911

Field Value

long

Properties

MaxCachedDisplayListCommands

Display-list cache budget per document, in total commands.

public long MaxCachedDisplayListCommands { get; init; }

Property Value

long

MaxCalculatorOperations

Maximum operators executed by a single Type 4 PostScript calculator evaluation.

public int MaxCalculatorOperations { get; init; }

Property Value

int

MaxCalculatorStackDepth

Maximum operand stack depth of a Type 4 PostScript calculator function.

public int MaxCalculatorStackDepth { get; init; }

Property Value

int

MaxColorSpaceNestingDepth

Maximum color space nesting depth (Indexed base, Separation/DeviceN alternate, named references).

public int MaxColorSpaceNestingDepth { get; init; }

Property Value

int

MaxCommandsPerPage

Maximum drawing commands per page display list.

public int MaxCommandsPerPage { get; init; }

Property Value

int

MaxDecodedStreamBytes

Maximum decoded stream expansion size in bytes (128 MB per stream).

public long MaxDecodedStreamBytes { get; init; }

Property Value

long

MaxDecompressionRatio

Maximum decompression expansion ratio (e.g. 500x).

public double MaxDecompressionRatio { get; init; }

Property Value

double

MaxFormXObjectDepth

Maximum Form XObject recursion depth (PDFium draws up to 40 levels too).

public int MaxFormXObjectDepth { get; init; }

Property Value

int

MaxFunctionNestingDepth

Maximum nesting depth of Type 3 stitching functions (and function arrays within them).

public int MaxFunctionNestingDepth { get; init; }

Property Value

int

MaxFunctionSamples

Maximum total sample values (prod(Size) x outputs) of a Type 0 sampled function.

public int MaxFunctionSamples { get; init; }

Property Value

int

MaxGlyphsPerPage

Maximum glyphs per page.

public long MaxGlyphsPerPage { get; init; }

Property Value

long

MaxGraphicsStateDepth

Maximum q nesting depth; deeper q operators are ignored (bounded recovery).

public int MaxGraphicsStateDepth { get; init; }

Property Value

int

MaxImagePixels

Maximum pixels of a single image (width × height).

public long MaxImagePixels { get; init; }

Property Value

long

MaxImagePixelsPerPage

Maximum total pixels of all images on one page.

public long MaxImagePixelsPerPage { get; init; }

Property Value

long

MaxNestingDepth

Maximum dictionary or array nesting depth.

public int MaxNestingDepth { get; init; }

Property Value

int

MaxObjectsCount

Maximum indirect object count to resolve per document.

public int MaxObjectsCount { get; init; }

Property Value

int

MaxOperatorsPerPage

Maximum content-stream operators executed per page, across Form XObjects and Type3 glyphs.

public long MaxOperatorsPerPage { get; init; }

Property Value

long

MaxPageBuildTime

Maximum wall-clock time to build one page display list.

public TimeSpan MaxPageBuildTime { get; init; }

Property Value

TimeSpan

MaxPageTreeDepth

Maximum page tree depth before aborting recursion.

public int MaxPageTreeDepth { get; init; }

Property Value

int

MaxPathSegmentsPerPage

Maximum path segments per page.

public long MaxPathSegmentsPerPage { get; init; }

Property Value

long

MaxTokenLength

Maximum string or token length in bytes (64 MB).

public int MaxTokenLength { get; init; }

Property Value

int

MaxTrailerChainDepth

Maximum number of /Prev trailer links to follow. Real files stay far below it, even after thousands of incremental saves. A longer chain, or a /Prev loop, makes the reader rebuild the cross-reference data by scanning the file (the document then reports it was repaired).

public int MaxTrailerChainDepth { get; init; }

Property Value

int

MaxTrailerChainEntries

Maximum cross-reference entries read along the whole /Prev chain (all sections together). Past it the reader rebuilds the cross-reference data by scanning the file instead.

public long MaxTrailerChainEntries { get; init; }

Property Value

long

MaxType3Depth

Maximum Type3 glyph procedure nesting (a Type3 glyph showing Type3 text).

public int MaxType3Depth { get; init; }

Property Value

int