1
0
mirror of https://github.com/roytam1/UXP.git synced 2026-05-26 13:58:49 +00:00

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
This commit is contained in:
Moonchild
2023-05-10 22:50:22 +02:00
committed by roytam1
parent fae36a95ec
commit cc6ef1f3b1
+4
View File
@@ -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++) {