Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Issue 216563002: [SVG Fonts] Fix <font-face> element leak document (Closed)

Created:
6 years, 9 months ago by kouhei (in TOK)
Modified:
6 years, 8 months ago
CC:
blink-reviews, krit, kouhei+svg_chromium.org, ed+blinkwatch_opera.com, fs, dglazkov+blink, apavlov+blink_chromium.org, gyuyoung.kim_webkit.org, darktears, f(malita), Stephen Chennney, rune+blink, pdr., rwlbuis, hajimehoshi, tasak
Visibility:
Public.

Description

[SVG Fonts] Fix <font-face> element leak document Reported by hajimehoshi@: A svg document with <font-face> was never destructed from a reference cycle. This patch breaks the reference cycle by making the reference from SVGFontFaceSource to SVGFontFaceElement weak. SVGFontFaceSource only exist for in-document font face reference, so this change is safe. This patch also validates SVGFontData's weak-ref to SVGFontFaceElement. SVGFontData should be only used while the document is alive. This CL changes the weak-ref to WeakPtr and ensure the svg tree is alive before reference. TEST=LayoutTests/svg/svg-font-face-leak-document.html BUG=270000 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=171231

Patch Set 1 #

Patch Set 2 : add_testcase #

Patch Set 3 : conservative fix? #

Patch Set 4 : upd #

Patch Set 5 : rebased #

Total comments: 2

Patch Set 6 : assert on getter #

Patch Set 7 : Editing bug workaround #

Total comments: 2

Patch Set 8 : rebased / add comment #

Patch Set 9 : rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+73 lines, -15 lines) Patch
M LayoutTests/fast/dom/remove-svg-font-face-element-crash.xhtml View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
A LayoutTests/svg/svg-font-face-leak-document.html View 1 1 chunk +23 lines, -0 lines 0 comments Download
A + LayoutTests/svg/svg-font-face-leak-document-expected.txt View 1 0 chunks +-1 lines, --1 lines 0 comments Download
M Source/core/css/FontFace.cpp View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -1 line 0 comments Download
M Source/core/rendering/svg/SVGTextRunRenderingContext.cpp View 1 2 3 4 5 6 1 chunk +4 lines, -0 lines 0 comments Download
M Source/core/svg/SVGFontData.h View 1 2 3 4 5 6 3 chunks +5 lines, -4 lines 0 comments Download
M Source/core/svg/SVGFontData.cpp View 1 2 3 4 5 6 7 6 chunks +24 lines, -7 lines 0 comments Download
M Source/core/svg/SVGFontFaceElement.h View 1 2 3 chunks +4 lines, -0 lines 0 comments Download
M Source/core/svg/SVGFontFaceElement.cpp View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/svg/SVGFontFaceSource.h View 1 2 1 chunk +4 lines, -2 lines 0 comments Download
M Source/core/svg/SVGFontFaceSource.cpp View 1 2 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 17 (0 generated)
kouhei (in TOK)
6 years, 9 months ago (2014-03-28 07:28:21 UTC) #1
Stephen Chennney
We've had a lot of security issues in this area, which leaves me rather hesitant. ...
6 years, 9 months ago (2014-03-28 11:24:52 UTC) #2
kouhei (in TOK)
+tasak
6 years, 8 months ago (2014-03-31 00:00:04 UTC) #3
kouhei (in TOK)
+ksakamoto Hi, I updated the CL with more conservative fix. SVGFontData now carries a WeakPtr ...
6 years, 8 months ago (2014-04-01 01:20:34 UTC) #4
Kunihiko Sakamoto
Can you update the change description? https://codereview.chromium.org/216563002/diff/70001/Source/core/svg/SVGFontData.h File Source/core/svg/SVGFontData.h (right): https://codereview.chromium.org/216563002/diff/70001/Source/core/svg/SVGFontData.h#newcode50 Source/core/svg/SVGFontData.h:50: SVGFontFaceElement* svgFontFaceElement() const ...
6 years, 8 months ago (2014-04-01 04:44:13 UTC) #5
kouhei (in TOK)
PTAL. https://codereview.chromium.org/216563002/diff/70001/Source/core/svg/SVGFontData.h File Source/core/svg/SVGFontData.h (right): https://codereview.chromium.org/216563002/diff/70001/Source/core/svg/SVGFontData.h#newcode50 Source/core/svg/SVGFontData.h:50: SVGFontFaceElement* svgFontFaceElement() const { return m_svgFontFaceElement.get(); } On ...
6 years, 8 months ago (2014-04-03 01:57:17 UTC) #6
Kunihiko Sakamoto
non-owner lgtm https://codereview.chromium.org/216563002/diff/110001/Source/core/svg/SVGFontData.cpp File Source/core/svg/SVGFontData.cpp (right): https://codereview.chromium.org/216563002/diff/110001/Source/core/svg/SVGFontData.cpp#newcode337 Source/core/svg/SVGFontData.cpp:337: return !m_svgFontFaceElement || !m_svgFontFaceElement->inDocument(); This is workaround ...
6 years, 8 months ago (2014-04-03 03:17:08 UTC) #7
kouhei (in TOK)
schenney: PTAL. https://codereview.chromium.org/216563002/diff/110001/Source/core/svg/SVGFontData.cpp File Source/core/svg/SVGFontData.cpp (right): https://codereview.chromium.org/216563002/diff/110001/Source/core/svg/SVGFontData.cpp#newcode337 Source/core/svg/SVGFontData.cpp:337: return !m_svgFontFaceElement || !m_svgFontFaceElement->inDocument(); On 2014/04/03 03:17:08, ...
6 years, 8 months ago (2014-04-03 09:17:58 UTC) #8
kouhei (in TOK)
schenney: PTAL. I think the patch is safe now.
6 years, 8 months ago (2014-04-09 08:07:56 UTC) #9
Stephen Chennney
LGTM. Good work and I apologise for the delay.
6 years, 8 months ago (2014-04-09 14:27:19 UTC) #10
kouhei (in TOK)
The CQ bit was checked by kouhei@chromium.org
6 years, 8 months ago (2014-04-10 00:58:00 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kouhei@chromium.org/216563002/150001
6 years, 8 months ago (2014-04-10 00:58:01 UTC) #12
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-04-10 01:50:30 UTC) #13
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.blink on win_blink_rel
6 years, 8 months ago (2014-04-10 01:50:31 UTC) #14
kouhei (in TOK)
The CQ bit was checked by kouhei@chromium.org
6 years, 8 months ago (2014-04-10 03:07:56 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kouhei@chromium.org/216563002/150001
6 years, 8 months ago (2014-04-10 03:08:05 UTC) #16
commit-bot: I haz the power
6 years, 8 months ago (2014-04-10 03:59:22 UTC) #17
Message was sent while issue was closed.
Change committed as 171231

Powered by Google App Engine
This is Rietveld 408576698