Closed JimBobSquarePants closed 6 months ago
I've now added configuration to MemoryAllocator
directly. I couldn't touch MemoryAllocatorOptions
since that would mean breaking several constructors. This limits all allocations for all operations.
@antonfirsov I really don't understand what you mean by this.
In practice this means that the 2D limit logic has to be pushed down to the memory group allocation code. I think the resulting code will be cleaner.
It is at the very root of the memory allocation code. We limit any and all allocations from within MemoryAllocator
itself.
Most importantly, we need good evidence for the default buffer limits we define.
65535*65535 is the maximum valid Jpeg dimension. 32767x32767 is half of that and what System.Drawing limits you to on all platforms.
The 1D buffer allocations could possibly be lower than 64/32MB but I chose those values because we already attempt to allocate 64MBin our memory tests.
@antonfirsov @tocsoft Can you please review at your earliest opportunity. I have something in place now that will enforce a limit while maintaining a sane configurable API.
@JimBobSquarePants I decided to communicate my ideas in an alternative PR #2706, let me know what you think.
@JimBobSquarePants I decided to communicate my ideas in an alternative PR #2706, let me know what you think.
Your PR Rulez, mine droolz.
Closed in favor of #2706
Prerequisites
Description
While the specification does not apply a limitation on BMP dimensions, on some machines attempting to decode a malformed or extremely large BMP can lead to OOM exceptions.
This change limits the dimensions to match the default set by browsers. For example Firefox
Fixes #2696