You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 41bdde6
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -114,6 +114,7 @@ Upgrading from 3.x? Upgrade to the latest 3.x release first, fix the deprecation
114
114
115
115
### New
116
116
117
+
-`renderSVG()`'s fixed limits of work throw a `LimitError` like its options' limits (an `Error` in 3.x): elements drawn through `<use>` references, nested masks, clip paths, patterns, markers and filter images, and entity expansion. `LimitError` is a `RangeError`, so `catch` blocks that test for `Error` still catch them.
117
118
-`GainMap.decode(data, { maxPixels })` takes the limit of `Image.decode()`, and the `LimitError` that these limits throw is exported (with `name``'LimitError'`).
118
119
-`rotate(angle, { expand: false })` keeps the image's size for quarter turns, too: the turned image is centered and what doesn't fit is cut off (they swapped width and height).
119
120
-`renderSVG()` throws for masks, clip paths, patterns, markers and filter images nested in each other so deeply that they would multiply (three per level took minutes at ten levels), and stops at 24 `feTurbulence` octaves, which are all that its output can hold. Shapes far outside the image no longer make rendering hang.
@@ -175,7 +176,7 @@ Upgrading from 3.x? Upgrade to the latest 3.x release first, fix the deprecation
175
176
- AVIF 4:2:0 images of an odd width decode the last column like libavif: it took the chroma of the column to its left too (off by up to 51).
176
177
-`Animation.decode()` counts every frame as at least 1024 pixels of `maxPixels`: a frame takes memory however small it is, so a 4.6 MB GIF of 200000 frames of 1x1 took 720 MB.
177
178
-`renderSVG()` bounds the work of markers: their elements count against the 100,000 elements of `<use>` references, and one render draws at most 10,000 markers (120,000 vertices with `marker-mid` took 135 s).
178
-
-`renderSVG()` bounds the work of filters: their primitives may work on 2^26 pixels plus 16 per pixel of the output in one render (once per pass: an `feConvolveMatrix` per 9 taps of its kernel, an `feTurbulence` per octave, an `feMerge` per node), more throws a `LimitError`; a filter's region counts against `maxLayerPixels` like the other layers (one of more than 2^26 pixels was left out without a word) (600 blurs and morphologies over a megapixel, 37 KB of SVG, took more than 3 GB and minutes), and the results a filter keeps for `result=` references count against `maxLayerPixels`.
179
+
-`renderSVG()` bounds the work of filters: their primitives may work on 2^25 pixels plus 16 per pixel of the output in one render (once per pass: an `feConvolveMatrix` per 9 taps of its kernel, an `feTurbulence` per octave, an `feMerge` per node), more throws a `LimitError`; a filter's region counts against `maxLayerPixels` like the other layers (one of more than 2^26 pixels was left out without a word) (600 blurs and morphologies over a megapixel, 37 KB of SVG, took more than 3 GB and minutes), and the results a filter keeps for `result=` references count against `maxLayerPixels`.
179
180
-`renderSVG()` parses `transform` lists in linear time: a long list of unclosed functions took 4.8 s at 280 KB.
// <use> references can multiply each other ("billion laughs"), markers repeat at every vertex: their elements are counted
944
-
if(context.instanced&&++this.budget.instances>MAX_INSTANCES)thrownewError(`SVG: more than ${MAX_INSTANCES} elements rendered through <use> references, markers or embedded SVGs`);
944
+
if(context.instanced&&++this.budget.instances>MAX_INSTANCES)thrownewLimitError(`SVG too complex: more than ${MAX_INSTANCES} elements rendered through <use> references, markers or embedded SVGs`);
945
945
946
946
conststyle=this.computeStyle(node,context.style);
947
947
if(style.display==='none')return;
@@ -1699,7 +1699,7 @@ class Document {
1699
1699
1700
1700
// (a marker is rendered at every vertex: its elements count like those of <use> references, and the
1701
1701
// markers themselves too, each a render of its own)
1702
-
if(++this.budget.markers>MAX_MARKERS)thrownewError(`SVG: more than ${MAX_MARKERS} markers`);
1702
+
if(++this.budget.markers>MAX_MARKERS)thrownewLimitError(`SVG too complex: more than ${MAX_MARKERS} markers`);
if(!error||!/markers/.test(error.message)||Date.now()-begin>30000*slack)panic(`120000 markers: expected the marker limit within 30 s, got ${error} after ${Date.now()-begin} ms`);
218
+
if(!error||error.name!=='LimitError'||!/markers/.test(error.message)||Date.now()-begin>30000*slack)panic(`120000 markers: expected the marker limit within 30 s, got ${error} after ${Date.now()-begin} ms`);
0 commit comments