A tiny, malicious SVG file (using nested/recursive <use>/<def> elements) causes firefox to stall and use up the system's memory
Categories
(Core :: SVG, defect)
Tracking
()
People
(Reporter: ebosman, Unassigned)
References
()
Details
(6 keywords, Whiteboard: [use] [external-report])
Attachments
(6 files, 1 external file)
Updated•18 years ago
|
Comment 1•18 years ago
|
||
Comment 2•18 years ago
|
||
Updated•18 years ago
|
Updated•17 years ago
|
Comment 3•17 years ago
|
||
Comment 4•17 years ago
|
||
Comment 5•17 years ago
|
||
Comment 6•17 years ago
|
||
| Reporter | ||
Updated•15 years ago
|
| Reporter | ||
Comment 7•15 years ago
|
||
Updated•14 years ago
|
Updated•13 years ago
|
Comment 8•12 years ago
|
||
Comment 10•11 years ago
|
||
Comment 11•11 years ago
|
||
Comment 12•11 years ago
|
||
Comment 13•11 years ago
|
||
Comment 14•11 years ago
|
||
Comment 16•5 years ago
|
||
This issue is still reproducible for me on the latest versions of Firefox Nightly 87.0a1 (2021-02-04), beta 86.0b6 and release 85.0 on Windows 10, Ubuntu 20.04 and MacOS 10.15.
Updating the flags accordingly.
Updated•4 years ago
|
Updated•2 years ago
|
Updated•1 year ago
|
Comment 20•6 months ago
|
||
It would be good to find a fix for this bug.
I don't have the skills myself to find a fix, I asked the claude AI for an idea.
It suggested to measure the complexity of the SVG rendering, and abort rendering when a limit is reached.
I'll attach a patch it made.
With this patch, rendering of the attached file is aborted after a few seconds.
A pref is introduced to control the limit.
Would this approach be reasonable, or could it serve as an inspiration for a fix for this bug?
Comment 21•6 months ago
|
||
Comment 22•5 months ago
|
||
If you want to track the expansion limit, you can do that in SVGUseElement rather than Document, that'd be more reliable because otherwise you get into correctness issues on long-running sessions that can hit that limit legitimately.
Comment 23•5 months ago
|
||
(In reply to Emilio Cobos Álvarez [:emilio] from comment #22)
If you want to track the expansion limit, you can do that in
SVGUseElementrather thanDocument, that'd be more reliable because otherwise you get into correctness issues on long-running sessions that can hit that limit legitimately.
The problem with that is each SVGUseElement then gets its own limit. If a SVG contains multiple uses, it seems we get many counters, IIUC?
Comment 24•5 months ago
|
||
Use elements already track their original element, you can just track in the outer one.
Comment 25•5 months ago
|
||
I'll submit a thought that I wanted to post as a follow up to my comment 23 below.
This was before I looked at your new comment 24.
What do you think about this modified approach, which can be seen in the attached patch.
I think your worry was specifically about a document into which multiple SVGs may be loaded over time, which may happen in long living documents. This might happen in Firefox, but it seems unlikely this would happen in Thunderbird.
It seems it can be detected whether an SVG file is loaded separately, or whether it's loaded inline.
The suggestion is that the limit is always enforced whenever the SVG is loaded by itself.
When an SVG is loaded inline into a document, the suggestion is to disable the limit in Firefox, but still enforce a global limit in Thunderbird.
Comment 26•5 months ago
|
||
That seems more complicated and hackier than just doing the right thing.
Comment 27•5 months ago
|
||
Can't I just put a <use> in a <iframe> in a <foreignObject> in a <use> in an <iframe>.... to trivially get round this latest approach? The iframe elements create separate documents so the counter would then be one per document but you'd still have a problem.
Comment 28•5 months ago
|
||
Yeah though iframes have a limit IIRC.
Comment 29•5 months ago
|
||
Still you could add like 10000 sibling iframes or something
Comment 30•5 months ago
|
||
Does that mean there is no reasonable fix for this bug?
Would you say this is a wontfix bug?
Comment 31•5 months ago
|
||
Well there's always bug 1477214
Comment 32•5 months ago
|
||
(In reply to Robert Longson [:longsonr] from comment #31)
Well there's always bug 1477214
I can't access it.
Description
•