mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-30 02:07:10 +01:00
fix: preserve large 16-bit PNG import limit
This commit is contained in:
1 parent
b3a8bf7df9
commit
2e6d3f8f94
1 file changed
+4
-1
@@ -962,7 +962,10 @@ pub fn raster_image(bytes: &[u8]) -> Result<RasterImage> {
|
||||
None => {
|
||||
let mut opts = craft_image_codecs::DecodeOptions::default();
|
||||
opts.limits.max_alloc = MAX_RASTER_ALLOC;
|
||||
opts.limits.max_pixels = MAX_RASTER_ALLOC / 4;
|
||||
// `max_alloc` checks the actual decoded sample size (including 16-bit RGBA).
|
||||
// Keep the former 1-billion-pixel ceiling; the RGBA allowance is separately
|
||||
// applied by `size_note` and the image placement path.
|
||||
opts.limits.max_pixels = 1 << 30;
|
||||
opts.keep_orientation = true;
|
||||
let decoded = craft_image_codecs::decode_as_with(kind, bytes, &opts).map_err(|e| match e {
|
||||
craft_image_codecs::CodecError::LimitExceeded(_) => err("image is too large to draw"),
|
||||
|
||||
Reference in new issue
Block a user