Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ const (
// Limit the size of the document
MAX_SECTORS = 1024 * 1024

sectorShiftV3 = 0x9
sectorShiftV4 = 0xC
sectorShiftV3 = 0x9
sectorShiftV4 = 0xC
miniSectorShift = 0x6

// MAX_DECOMPRESSED bounds DecompressStream output. MS-OVBA copy tokens can
// expand a 4096-byte chunk window repeatedly; a crafted input could
// otherwise amplify to tens of GiB and OOM the process. Legit VBA dir/source
// streams are well under this.
MAX_DECOMPRESSED = 32 * 1024 * 1024 // 32 MiB

// MAX_MODULES caps the VBA project module count. The uint16 field is already
// dir_stream-bounded, but a generous explicit cap stops a degenerate
// high-count header from driving a long parse loop (kept generous; real
// projects are <<4096 modules).
MAX_MODULES = 4096
)
Loading
Loading