Changeset 109299 in webkit
- Timestamp:
- Feb 29, 2012, 7:54:24 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 3 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/svg/custom/bug78807-expected.txt (added)
-
LayoutTests/svg/custom/bug78807.svg (added)
-
LayoutTests/svg/custom/bug78838-expected.txt (added)
-
LayoutTests/svg/custom/bug78838.html (added)
-
LayoutTests/svg/custom/bug79798-expected.txt (added)
-
LayoutTests/svg/custom/bug79798.html (added)
-
LayoutTests/svg/custom/resources/bug78838.svg (added)
-
LayoutTests/svg/custom/resources/bug79798.svg (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/svg/SVGUseElement.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r109298 r109299 1 2012-02-29 Stephen Chenney <schenney@chromium.org> 2 3 SVG <use> element allows invalid contents 4 https://bugs.webkit.org/show_bug.cgi?id=77764 5 6 Reviewed by Nikolas Zimmermann. 7 8 These test all use invalid elements in the <use> and crash in the absence 9 of this patch. Existing tests cover the valid elements in <use>, so no 10 additional tests for those. 11 12 * svg/custom/bug78807-expected.txt: Added. 13 * svg/custom/bug78807.svg: Added. 14 * svg/custom/bug78838-expected.txt: Added. 15 * svg/custom/bug78838.html: Added. 16 * svg/custom/bug79798-expected.txt: Added. 17 * svg/custom/bug79798.html: Added. 18 * svg/custom/resources/bug78838.svg: Added. 19 * svg/custom/resources/bug79798.svg: Added. 20 1 21 2012-02-29 Ami Fischman <fischman@chromium.org> 2 22 -
trunk/Source/WebCore/ChangeLog
r109298 r109299 1 2012-02-29 Stephen Chenney <schenney@chromium.org> 2 3 SVG <use> element allows invalid contents 4 https://bugs.webkit.org/show_bug.cgi?id=77764 5 6 Reviewed by Nikolas Zimmermann. 7 8 Modify the isDisallowedElement method to disallow all of the 9 disallowed elements, instead of just a few. It is now a whitelist 10 implementation. 11 12 This also fixes bugs 78807, 78838 and 79798 related to memory 13 corruption issues. 14 15 Tests: svg/custom/bug78807.svg 16 svg/custom/bug78838.html 17 svg/custom/bug79798.html 18 19 * svg/SVGUseElement.cpp: 20 (WebCore::isDisallowedElement): 21 1 22 2012-02-29 Ami Fischman <fischman@chromium.org> 2 23 -
trunk/Source/WebCore/svg/SVGUseElement.cpp
r109097 r109299 276 276 #endif 277 277 278 static bool isDisallowedElement(Node* element) 279 { 280 // <foreignObject> should never be contained in a <use> tree. Too dangerous side effects possible. 281 if (element->hasTagName(SVGNames::foreignObjectTag)) 278 static bool isDisallowedElement(Node* node) 279 { 280 // Spec: "Any 'svg', 'symbol', 'g', graphics element or other 'use' is potentially a template object that can be re-used 281 // (i.e., "instanced") in the SVG document via a 'use' element." 282 // "Graphics Element" is defined as 'circle', 'ellipse', 'image', 'line', 'path', 'polygon', 'polyline', 'rect', 'text' 283 // Excluded are anything that is used by reference or that only make sense to appear once in a document. 284 // We must also allow the shadow roots of other use elements. 285 if (node->isShadowRoot()) 286 return false; 287 288 if (!node->isSVGElement()) 282 289 return true; 283 if (SVGSMILElement::isSMILElement(element)) 284 return true; 285 return false; 290 291 Element* element = static_cast<Element*>(node); 292 293 DEFINE_STATIC_LOCAL(HashSet<String>, allowedElementTags, ()); 294 if (allowedElementTags.isEmpty()) { 295 allowedElementTags.add(SVGNames::aTag.toString()); 296 allowedElementTags.add(SVGNames::circleTag.toString()); 297 allowedElementTags.add(SVGNames::descTag.toString()); 298 allowedElementTags.add(SVGNames::ellipseTag.toString()); 299 allowedElementTags.add(SVGNames::gTag.toString()); 300 allowedElementTags.add(SVGNames::imageTag.toString()); 301 allowedElementTags.add(SVGNames::lineTag.toString()); 302 allowedElementTags.add(SVGNames::metadataTag.toString()); 303 allowedElementTags.add(SVGNames::pathTag.toString()); 304 allowedElementTags.add(SVGNames::polygonTag.toString()); 305 allowedElementTags.add(SVGNames::polylineTag.toString()); 306 allowedElementTags.add(SVGNames::rectTag.toString()); 307 allowedElementTags.add(SVGNames::svgTag.toString()); 308 allowedElementTags.add(SVGNames::switchTag.toString()); 309 allowedElementTags.add(SVGNames::symbolTag.toString()); 310 allowedElementTags.add(SVGNames::textTag.toString()); 311 allowedElementTags.add(SVGNames::textPathTag.toString()); 312 allowedElementTags.add(SVGNames::titleTag.toString()); 313 allowedElementTags.add(SVGNames::trefTag.toString()); 314 allowedElementTags.add(SVGNames::tspanTag.toString()); 315 allowedElementTags.add(SVGNames::useTag.toString()); 316 } 317 return !allowedElementTags.contains(element->tagName()); 286 318 } 287 319
Note:
See TracChangeset
for help on using the changeset viewer.