Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Gem::SafeMarshal::Reader#read_count

read_count

Reads an element count and validates it against the number of bytes remaining in the input, since each element to be read consumes at least one byte. This prevents allocating huge backing stores for maliciously crafted lengths that could never be satisfied.