Merge main into feat/native-save-precision

This commit is contained in:
dotCooCoo
2026-10-27 20:34:51 -07:00
1138 changed files with 176049 additions and 145413 deletions
+6 -2
View File
@@ -66,8 +66,10 @@ pub const EXTENSION: &str = "vectorcraft";
pub const LEGACY_EXTENSION: &str = "drawcraft";
/// Most bytes the JSON of a compressed file may unpack to (a guard against decompression bombs,
/// as are [`MAX_BLOB`] and [`MAX_BLOBS`]). A compressed save refuses a document past any of them,
/// so every file VectorCraft writes reads back.
pub const MAX_JSON: u64 = 1 << 30;
/// so every file VectorCraft writes reads back. On wasm32 the cap is a quarter of the native
/// one: the JSON is deserialized into a document several times its size, and the 4 GiB address
/// space also holds the file, the JSON, the document and the app (#3587).
pub const MAX_JSON: u64 = if cfg!(target_arch = "wasm32") { 256 << 20 } else { 1 << 30 };
/// Most bytes one entry of the data after the JSON (an image, a placed document, the PDF, a
/// profile) may have in a compressed file.
pub const MAX_BLOB: u64 = 1 << 30;
@@ -617,6 +619,8 @@ pub fn load_file(bytes: &[u8]) -> Result<NativeFile, FormatError> {
doc.setup.keep_in_range();
// Untrusted: capped, named and pointing at objects the file has.
doc.tidy_saved_selections();
// Untrusted: capped, named and with a zoom and centre the canvas can show.
doc.tidy_views();
doc.tidy_graph_designs();
doc.raster_effects.add_around = doc.raster_effects.add_around.clamp(0.0, vectorcraft_doc::rastersettings::MAX_ADD_AROUND);
let mut depth_notes = vec![];