Changeset 201608 in webkit
- Timestamp:
- Jun 2, 2016, 12:05:40 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/css/calc-with-two-variables-crash-expected.txt (added)
-
LayoutTests/fast/css/calc-with-two-variables-crash.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/CSSGrammar.y.in (modified) (4 diffs)
-
Source/WebCore/css/CSSParserValues.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSParserValues.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r201604 r201608 1 2016-06-02 Daniel Bates <dabates@apple.com> 2 3 Fix a couple of mistakes in CSSParserValue memory management 4 https://bugs.webkit.org/show_bug.cgi?id=158307 5 <rdar://problem/26127225> 6 7 Reviewed by Darin Adler. 8 9 * fast/css/calc-with-two-variables-crash-expected.txt: Added. 10 * fast/css/calc-with-two-variables-crash.html: Added. 11 1 12 2016-06-02 Said Abou-Hallawa <sabouhallawa@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r201604 r201608 1 2016-06-02 Darin Adler <darin@apple.com> 2 3 Fix a couple of mistakes in CSSParserValue memory management 4 https://bugs.webkit.org/show_bug.cgi?id=158307 5 <rdar://problem/26127225> 6 7 Reviewed by Daniel Bates. 8 9 * css/CSSGrammar.y.in: Added a destructor for calc_func_term. This presumably 10 fixes some memory leaks in error cases. Removed an assertion about not needing 11 a call to destroy that was far too limited. Tweaked formatting of the percentage 12 ase in the key production. Indented calc_func_term to make it consistent with 13 other productions nearby. 14 15 * css/CSSParserValues.cpp: 16 (WebCore::CSSParserValueList::~CSSParserValueList): Use a modern for loop. 17 (WebCore::CSSParserValueList::deleteValueAt): Deleted. Unused function, and also 18 would have resulted in a memory leak unless the code already extracted the value 19 from the list. 20 (WebCore::CSSParserValueList::extend): Properly transfer ownership from one value 21 list to the other by setting the unit to 0 in the donor. 22 23 * css/CSSParserValues.h: Removed unused deleteValueAt function. 24 1 25 2016-06-02 Said Abou-Hallawa <sabouhallawa@apple.com> 2 26 -
trunk/Source/WebCore/css/CSSGrammar.y.in
r201441 r201608 295 295 %destructor { delete $$; } keyframes_rule 296 296 297 // These parser values never need to be destroyed because they are never functions or value lists.298 %type <value> calc_func_termkey unary_term299 300 // These parser values need to be destroyed because they might be functions .301 %type <value> calc_func tion function variable_function min_or_max_function term302 %destructor { destroy($$); } calc_func tion function variable_function min_or_max_function term297 // These parser values never need to be destroyed because they are never functions, value lists, or variables. 298 %type <value> key unary_term 299 300 // These parser values need to be destroyed because they might be functions, value lists, or variables. 301 %type <value> calc_func_term calc_function function min_or_max_function term variable_function 302 %destructor { destroy($$); } calc_func_term calc_function function min_or_max_function term variable_function 303 303 304 304 %type <id> property … … 838 838 | key_list maybe_space ',' maybe_space key { 839 839 $$ = $1; 840 ASSERT($5.unit != CSSParserValue::Function); // No need to call destroy.841 840 if ($$) 842 841 $$->addValue($5); … … 845 844 846 845 key: 847 maybe_unary_operator PERCENTAGE { $$.id = CSSValueInvalid; $$.isInt = false; $$.fValue = $1 * $2; $$.unit = CSSPrimitiveValue::CSS_NUMBER; } 846 maybe_unary_operator PERCENTAGE { 847 $$.id = CSSValueInvalid; 848 $$.isInt = false; 849 $$.fValue = $1 * $2; 850 $$.unit = CSSPrimitiveValue::CSS_NUMBER; 851 } 848 852 | IDENT { 849 853 $$.id = CSSValueInvalid; … … 1861 1865 1862 1866 calc_func_term: 1863 unary_term1864 | variable_function { $$= $1; }1865 | unary_operator unary_term { $$ = $2; $$.fValue *= $1; }1866 ;1867 unary_term 1868 | unary_operator unary_term { $$ = $2; $$.fValue *= $1; } 1869 | variable_function 1870 ; 1867 1871 1868 1872 /* -
trunk/Source/WebCore/css/CSSParserValues.cpp
r200626 r201608 47 47 CSSParserValueList::~CSSParserValueList() 48 48 { 49 for (size_t i = 0, size = m_values.size(); i < size; i++) 50 destroy(m_values[i]); 51 } 52 53 void CSSParserValueList::addValue(const CSSParserValue& v) 54 { 55 m_values.append(v); 56 } 57 58 void CSSParserValueList::insertValueAt(unsigned i, const CSSParserValue& v) 59 { 60 m_values.insert(i, v); 61 } 62 63 void CSSParserValueList::deleteValueAt(unsigned i) 64 { 65 m_values.remove(i); 66 } 67 68 void CSSParserValueList::extend(CSSParserValueList& valueList) 69 { 70 for (unsigned int i = 0; i < valueList.size(); ++i) 71 m_values.append(*(valueList.valueAt(i))); 49 for (auto& value : m_values) 50 destroy(value); 51 } 52 53 void CSSParserValueList::addValue(const CSSParserValue& value) 54 { 55 m_values.append(value); 56 } 57 58 void CSSParserValueList::insertValueAt(unsigned i, const CSSParserValue& value) 59 { 60 m_values.insert(i, value); 61 } 62 63 void CSSParserValueList::extend(CSSParserValueList& other) 64 { 65 for (auto& value : other.m_values) { 66 m_values.append(value); 67 value.unit = 0; // We moved the CSSParserValue from the other list; this acts like std::move. 68 } 72 69 } 73 70 -
trunk/Source/WebCore/css/CSSParserValues.h
r200626 r201608 19 19 */ 20 20 21 #ifndef CSSParserValues_h 22 #define CSSParserValues_h 21 #pragma once 23 22 24 23 #include "CSSSelector.h" … … 141 140 void addValue(const CSSParserValue&); 142 141 void insertValueAt(unsigned, const CSSParserValue&); 143 void deleteValueAt(unsigned);144 142 void extend(CSSParserValueList&); 145 143 … … 279 277 280 278 } 281 282 #endif
Note:
See TracChangeset
for help on using the changeset viewer.