Changeset 51627 in webkit
- Timestamp:
- Dec 3, 2009 1:22:14 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r51626 r51627 1 2009-12-03 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Maciej Stachowiak. 4 5 NULL ptr in SVGPathSegList::getPathSegAtLength() 6 https://bugs.webkit.org/show_bug.cgi?id=30313 7 8 Add testcases for incorrect pathSeg usage. 9 10 * svg/dom/svgpath-out-of-bounds-getPathSeg-expected.txt: Added. 11 * svg/dom/svgpath-out-of-bounds-getPathSeg.html: Added. 12 1 13 2009-12-02 Shinichiro Hamaji <hamaji@chromium.org> 2 14 -
trunk/WebCore/ChangeLog
r51623 r51627 1 2009-12-03 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Maciej Stachowiak. 4 5 NULL ptr in SVGPathSegList::getPathSegAtLength() 6 https://bugs.webkit.org/show_bug.cgi?id=30313 7 8 Add exception checks to SVGPathSegList's implementation to catch (and propagate) exceptions. 9 Add null checks to SVGList's content manipulation functions to prevent 10 null values from entering the list in the first place. 11 12 Test: svg/dom/svgpath-out-of-bounds-getPathSeg.html 13 14 * svg/SVGList.h: 15 (WebCore::SVGList::initialize): 16 (WebCore::SVGList::insertItemBefore): 17 (WebCore::SVGList::replaceItem): 18 (WebCore::SVGList::appendItem): 19 * svg/SVGPathElement.cpp: 20 (WebCore::SVGPathElement::getPathSegAtLength): 21 * svg/SVGPathElement.h: 22 * svg/SVGPathElement.idl: 23 * svg/SVGPathSegList.cpp: 24 (WebCore::SVGPathSegList::getPathSegAtLength): 25 (WebCore::SVGPathSegList::toPathData): 26 (WebCore::SVGPathSegList::createAnimated): 27 * svg/SVGPathSegList.h: 28 1 29 2009-12-02 Yusuke Sato <yusukes@chromium.org> 2 30 -
trunk/WebCore/svg/SVGList.h
r50583 r51627 57 57 Item initialize(Item newItem, ExceptionCode& ec) 58 58 { 59 if (!newItem) { 60 ec = TYPE_MISMATCH_ERR; 61 return TypeOperations::nullItem(); 62 } 59 63 clear(ec); 60 64 return appendItem(newItem, ec); … … 93 97 } 94 98 95 Item insertItemBefore(Item newItem, unsigned int index, ExceptionCode&) 96 { 99 Item insertItemBefore(Item newItem, unsigned int index, ExceptionCode& ec) 100 { 101 if (!newItem) { 102 ec = TYPE_MISMATCH_ERR; 103 return TypeOperations::nullItem(); 104 } 105 97 106 if (index < m_vector.size()) { 98 107 m_vector.insert(index, newItem); … … 109 118 return TypeOperations::nullItem(); 110 119 } 120 121 if (!newItem) { 122 ec = TYPE_MISMATCH_ERR; 123 return TypeOperations::nullItem(); 124 } 111 125 112 126 m_vector[index] = newItem; … … 126 140 } 127 141 128 Item appendItem(Item newItem, ExceptionCode&) 129 { 142 Item appendItem(Item newItem, ExceptionCode& ec) 143 { 144 if (!newItem) { 145 ec = TYPE_MISMATCH_ERR; 146 return TypeOperations::nullItem(); 147 } 148 130 149 m_vector.append(newItem); 131 150 return newItem; -
trunk/WebCore/svg/SVGPathElement.cpp
r50583 r51627 70 70 } 71 71 72 unsigned long SVGPathElement::getPathSegAtLength(float length )73 { 74 return pathSegList()->getPathSegAtLength(length );72 unsigned long SVGPathElement::getPathSegAtLength(float length, ExceptionCode& ec) 73 { 74 return pathSegList()->getPathSegAtLength(length, ec); 75 75 } 76 76 -
trunk/WebCore/svg/SVGPathElement.h
r49602 r51627 63 63 float getTotalLength(); 64 64 FloatPoint getPointAtLength(float distance); 65 unsigned long getPathSegAtLength(float distance );65 unsigned long getPathSegAtLength(float distance, ExceptionCode&); 66 66 67 67 static PassRefPtr<SVGPathSegClosePath> createSVGPathSegClosePath(); -
trunk/WebCore/svg/SVGPathElement.idl
r16982 r51627 38 38 float getTotalLength(); 39 39 SVGPoint getPointAtLength(in float distance); 40 unsigned long getPathSegAtLength(in float distance); 40 unsigned long getPathSegAtLength(in float distance) 41 raises(DOMException, SVGException); 41 42 42 43 SVGPathSegClosePath createSVGPathSegClosePath(); -
trunk/WebCore/svg/SVGPathSegList.cpp
r36406 r51627 52 52 } 53 53 54 unsigned SVGPathSegList::getPathSegAtLength(double )54 unsigned SVGPathSegList::getPathSegAtLength(double, ExceptionCode& ec) 55 55 { 56 56 // FIXME : to be useful this will need to support non-normalized SVGPathSegLists 57 ExceptionCode ec = 0;58 57 int len = numberOfItems(); 59 58 // FIXME: Eventually this will likely move to a "path applier"-like model, until then PathTraversalState is less useful as we could just use locals … … 61 60 for (int i = 0; i < len; ++i) { 62 61 SVGPathSeg* segment = getItem(i, ec).get(); 62 if (ec) 63 return 0; 63 64 float segmentLength = 0; 64 65 switch (segment->pathSegType()) { … … 105 106 // FIXME : This should also support non-normalized PathSegLists 106 107 Path pathData; 108 int len = numberOfItems(); 107 109 ExceptionCode ec = 0; 108 int len = numberOfItems();109 110 for (int i = 0; i < len; ++i) { 110 111 SVGPathSeg* segment = getItem(i, ec).get(); 112 if (ec) 113 return Path(); 111 114 switch (segment->pathSegType()) { 112 115 case SVGPathSeg::PATHSEG_MOVETO_ABS: … … 183 186 return 0; 184 187 RefPtr<SVGPathSegList> result = create(fromList->associatedAttributeName()); 185 ExceptionCode ec ;188 ExceptionCode ec = 0; 186 189 for (unsigned n = 0; n < itemCount; ++n) { 187 190 SVGPathSeg* from = fromList->getItem(n, ec).get(); 191 if (ec) 192 return 0; 188 193 SVGPathSeg* to = toList->getItem(n, ec).get(); 194 if (ec) 195 return 0; 189 196 if (from->pathSegType() == SVGPathSeg::PATHSEG_UNKNOWN || from->pathSegType() != to->pathSegType()) 190 197 return 0; … … 252 259 } 253 260 result->appendItem(segment, ec); 261 if (ec) 262 return 0; 254 263 } 255 264 return result.release(); -
trunk/WebCore/svg/SVGPathSegList.h
r34358 r51627 37 37 virtual ~SVGPathSegList(); 38 38 39 unsigned getPathSegAtLength(double );39 unsigned getPathSegAtLength(double, ExceptionCode&); 40 40 Path toPathData(); 41 41
Note: See TracChangeset
for help on using the changeset viewer.