WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
6000
<use> does not handle recursion safely
https://bugs.webkit.org/show_bug.cgi?id=6000
Summary
<use> does not handle recursion safely
Eric Seidel (no email)
Reported
2005-12-08 01:25:39 PST
<use> does not handle recursion correctly If nothing else, <use> needs to check for recursive loops, otherwise Safari might just blow up on bad content. The FireFox devs have some testcase for these sorts of things which I will attach.
Attachments
Patch rewriting use - not ready yet!
(54.26 KB, patch)
2007-01-17 06:46 PST
,
Nikolas Zimmermann
no flags
Details
Formatted Diff
Diff
Initial patch
(260.91 KB, patch)
2007-01-28 13:45 PST
,
Nikolas Zimmermann
no flags
Details
Formatted Diff
Diff
Updated patch
(316.70 KB, patch)
2007-01-29 04:32 PST
,
Nikolas Zimmermann
sam
: review-
Details
Formatted Diff
Diff
Final patch
(316.70 KB, patch)
2007-01-30 04:34 PST
,
Nikolas Zimmermann
mrowe
: review+
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Eric Seidel (no email)
Comment 1
2006-01-26 15:23:15 PST
Because these could all be Safari crashers, we would not want to ship an SVG implementation without these fixed. Adding SVGHitList keyword and bumping to P2. I began a patch at one time to fix <pattern> and <gradient>. The way that I envision solving this is: 1. Create a on-the-stack simplified "pattern attributes" or "gradient attributes" structure. 2. Loop backwards through the xlink:href parent chain until either one of the following: - All attributes in the structure are filled - The chain terminates (no more, or you reach a node you've seen before). I would suggest using a HashSet to keep track of all the nodes that you've seen when walking backwards. In all three cases one of the required "attributes" to track in this structure is a pointer to whichever pattern/gradient/use element actually had children that you're going to render. In all three cases, if an element does not itself have children, it uses the children of the first element in its xlink:href inheritance chain when rendering.
Eric Seidel (no email)
Comment 2
2006-04-09 13:03:15 PDT
I'm adding the NeedsReduction keyword as this bug really could use probably 10+ test cases to catch all the recursion cases coverd by these elements.
Eric Seidel (no email)
Comment 3
2006-12-31 19:53:54 PST
At least gradients and patterns are likely to be addressed in Wildfox's next patch.
Nikolas Zimmermann
Comment 4
2007-01-02 04:26:12 PST
Fixed by
bug 12013
patch for gradients & patterns. <use> still TODO. Landed in
r18521
.
Nikolas Zimmermann
Comment 5
2007-01-17 06:46:34 PST
Created
attachment 12503
[details]
Patch rewriting use - not ready yet! Patch for early-birds - not ready yet.
Nikolas Zimmermann
Comment 6
2007-01-28 13:45:40 PST
Created
attachment 12731
[details]
Initial patch Hopefully the last big <use> rewrite - this time using a proper shadow tree! Fixes all issues & uglyness we had before.
Oliver Hunt
Comment 7
2007-01-28 14:09:59 PST
Comment on
attachment 12731
[details]
Initial patch SVGUseElement: - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <
zimmermann@kde.org
> - 2004, 2005, 2006 Rob Buis <
buis@kde.org
> + Copyright (C) 2007 Nikolas Zimmermann <
zimmermann@kde.org
> You're removing Rob's copyright??? SVGUseElement.cpp: replace NOTE: with FIXME: Looks fine to me, but i'd be happier if eric did a once over as well
Nikolas Zimmermann
Comment 8
2007-01-28 14:16:00 PST
(In reply to
comment #7
)
> (From update of
attachment 12731
[details]
[edit]) > SVGUseElement: > - Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann > <
zimmermann@kde.org
> > - 2004, 2005, 2006 Rob Buis <
buis@kde.org
> > + Copyright (C) 2007 Nikolas Zimmermann <
zimmermann@kde.org
> > > You're removing Rob's copyright???
Whoops, copy'n'paste! Will fix. My copyright year is also wrong...
> SVGUseElement.cpp: replace NOTE: with FIXME:
Okay.
> Looks fine to me, but i'd be happier if eric did a once over as well
Thanks for the review! :-) Niko
Eric Seidel (no email)
Comment 9
2007-01-28 14:48:17 PST
Comment on
attachment 12731
[details]
Initial patch The patch seems fine. It does not seem to address the bug however. Nor does it seem to have tests for the bug. The bug was about <use> recursion, and how recursive <use>'s could send Safari off spinning forever. Maybe that's handled here and I just don't see it. Also, this seems strange: *to->attributes() = *from->attributes();
Nikolas Zimmermann
Comment 10
2007-01-29 04:29:42 PST
(In reply to
comment #9
)
> (From update of
attachment 12731
[details]
[edit]) > The patch seems fine. It does not seem to address the bug however. Nor does > it seem to have tests for the bug. > > The bug was about <use> recursion, and how recursive <use>'s could send Safari > off spinning forever. Maybe that's handled here and I just don't see it.
Hehe funny, I mixed up things, I thought this bug was about "expansion" of <use> elements. Uploading new patch which contains 4 recursion tests, and actually handles recursion. Good catch :-)
> Also, this seems strange: > *to->attributes() = *from->attributes();
This is common WebCore code: (see Element::cloneNode) ... // clone attributes if (namedAttrMap) *clone->attributes() = *namedAttrMap; ... Niko
Nikolas Zimmermann
Comment 11
2007-01-29 04:32:48 PST
Created
attachment 12736
[details]
Updated patch This time it actually also fixes this bug - handle recursion properly. As SVG spec doesn't say a word about recursion, I'm doing the only logical thing: just ignore cycles.
Mark Rowe (bdash)
Comment 12
2007-01-29 05:10:23 PST
Comment on
attachment 12736
[details]
Updated patch Discussed a slightly updated version of this on IRC. r=me
Sam Weinig
Comment 13
2007-01-29 17:14:54 PST
Comment on
attachment 12736
[details]
Updated patch Marking r- until the leaks are dealt with.
Nikolas Zimmermann
Comment 14
2007-01-30 04:34:06 PST
Created
attachment 12788
[details]
Final patch Finally it does not leak anymore! The problematic area was SVGElementInstance, it always ref()'ed the correspondingUseElement so these never got deleted, once expandUseElementsInShadowTree() was executed. No new regressions - <use> feels much more stable today (ie. carto.net/window.svg works _perfectly_ now - no bugs!), no new leaks. All fine :-)
Mark Rowe (bdash)
Comment 15
2007-01-30 04:47:29 PST
Comment on
attachment 12788
[details]
Final patch r=me. Glad to see you finally tracked those leaks down!
Sam Weinig
Comment 16
2007-01-30 11:54:07 PST
Landed in
r19254
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug