Most image decoding libraries allow limiting the maximum size of the decoded images. This PR adds an setting to the decoder for controlling the maximum amount of bytes allowed for the decoded image based on width height num_components.
The default maximum is set to usize::MAX which means "unlimited" for the current platform. But it might be better to add a lower limit by default because JPEGs can be 2^16-1 * 2^16-1 which would mean a maximum of nearly 16 GiB in case of 4 components...
Most image decoding libraries allow limiting the maximum size of the decoded images. This PR adds an setting to the decoder for controlling the maximum amount of bytes allowed for the decoded image based on width height num_components.
The default maximum is set to usize::MAX which means "unlimited" for the current platform. But it might be better to add a lower limit by default because JPEGs can be 2^16-1 * 2^16-1 which would mean a maximum of nearly 16 GiB in case of 4 components...
This possibly fixes #133