With a raised max_pixels on wasm32, a picture could pass every check and
then ask vec! for more than isize::MAX bytes for its scan line or its
float picture, which panics with a capacity overflow instead of returning
an error.
- decode checks the byte count of the scan line and of the float picture
against isize::MAX before allocating either, and returns
LimitExceeded("pixel count") when one is over.
- Each header line is measured as text after invalid bytes become U+FFFD,
and a line over isize::MAX bytes is LimitExceeded("header length").
- The resolution line reads its first four tokens without collecting the
rest.
- The size checks take the bound as a value, and tests check them against
the 32-bit bound without allocating.
FilmCraft's clean-room Radiance HDR reader as a crate: flat, old and new
run-length scan lines, all eight axis orders, to linear float RGB. Scan lines
are validated before the float picture is allocated.