Skip to content

Bugfix - Fix alloc limit#393

Open
farhanfarasdak wants to merge 1 commit into
vmihailenco:v5from
farhanfarasdak:fix/alloc-limit
Open

Bugfix - Fix alloc limit#393
farhanfarasdak wants to merge 1 commit into
vmihailenco:v5from
farhanfarasdak:fix/alloc-limit

Conversation

@farhanfarasdak

Copy link
Copy Markdown

Background
a 5-byte array32 header declares up to ~4.29B elements, and decodeSliceValue pre-allocates that many before reading any data, because the cap check flags & disableAllocLimitFlag != 1 can never be true (the flag value is 8, so flags & 8 is 0 or 8, never 1). Plus the uncapped interface{} path. It can cause DoS via memory exhaustion; why a competent dev writes "read count → make(T,count)"; and the four traps when fixing it (spotting the typo, missing the interface/map paths, breaking semantics by hard-truncating, and preserving the DisableAllocLimit opt-out).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant