mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-02 06:07:06 -06:00
fix(format): read a native document within an object budget (#3587)
Opening a native document now reads at most MAX_READ_NODES objects (4M, 512K on wasm32) and refuses the file past that with a message naming the budget. Paths already read within MAX_READ_ANCHORS and the web build's JSON cap is 256 MB, but the number of objects had no bound: a gzip'd document of empty groups costs about 270 bytes per object once read against some 50 in its JSON, so 10M groups in a 24 MB file took 2.7 GB to open. NodeWire's id is read through counted_id, so each object counts once as it is read. load_file reads through a private load_file_within so a test can exercise the budget without a 4M-object document.
This commit is contained in:
@@ -32,6 +32,7 @@ pub use kind::{ImageObject, NodeKind};
|
||||
pub use live_shape::{LiveShape, Scaling};
|
||||
pub use opacity::{Knockout, OpacityMask, whiten};
|
||||
use wire::NodeWire;
|
||||
pub use wire::{MAX_READ_NODES, with_node_budget};
|
||||
|
||||
fn yes() -> bool {
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user