diff options
author | Moonchild <moonchild@palemoon.org> | 2023-05-10 22:50:22 +0200 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2023-05-10 22:50:22 +0200 |
commit | 8666ce68fc5fa6eb8547babee23e60ca4c3bfd98 (patch) | |
tree | 505cb75ceb9adc5fd555e7d3450280988d4af7d1 /image | |
parent | f9f3dfd1ac0f4e89bcff67ab53b27acf94e20c90 (diff) | |
download | uxp-8666ce68fc5fa6eb8547babee23e60ca4c3bfd98.tar.gz |
No issue - Limit JPEG decoder memory allocation to surface cache size.
This means that for trivial images whose header specifies large
dimensions but with no image data, we don't waste a lot of memory.
See BZ bug 1277397
Diffstat (limited to 'image')
-rw-r--r-- | image/decoders/nsJPEGDecoder.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/image/decoders/nsJPEGDecoder.cpp b/image/decoders/nsJPEGDecoder.cpp index 7fc749890f..1ac25fc6e2 100644 --- a/image/decoders/nsJPEGDecoder.cpp +++ b/image/decoders/nsJPEGDecoder.cpp @@ -154,6 +154,10 @@ nsJPEGDecoder::InitInternal() mSourceMgr.skip_input_data = skip_input_data; mSourceMgr.resync_to_restart = jpeg_resync_to_restart; mSourceMgr.term_source = term_source; + + // Limit the maximum allocation to the maximum our surface cache can hold. + mInfo.mem->max_memory_to_use = static_cast<long>( + std::min<size_t>(SurfaceCache::MaximumCapacity(), LONG_MAX)); // Record app markers for ICC data for (uint32_t m = 0; m < 16; m++) { |