#1095973 libheif1: Do not load big photo (200 megapixels)

#1095973#5
Date:
2025-02-14 13:53:00 UTC
From:
To:
Dear Maintainer,

When I try to load a .heic photo:

,----
| Memory allocation error: Security limit exceeded: Allocating 599270415
| exceeds the security limit of 536870912 bytes
`----

This is a "security limit" in libheif.

Upstream don't want do fix that.

https://github.com/strukturag/libheif/issues/192

Here is a simple patch to increase this limit from 512 MB to 1GB

,----
| --- a/libheif/security_limits.cc
| +++ b/libheif/security_limits.cc
| @@ -35,7 +35,7 @@ struct heif_security_limits global_secur
|      .max_items = 1000,
|
|      .max_color_profile_size = 100 * 1024 * 1024, // 100 MB
| -    .max_memory_block_size = 512 * 1024 * 1024,  // 512 MB
| +    .max_memory_block_size = 1024 * 1024 * 1024,  // 512 MB
|
|      .max_components = 256,
|      .max_iloc_extents_per_item = 32,
`----

Christian