Summary: | REGRESSION (r118044): CSSParser crashes, when no context is available, and the value is a valid keyword | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Renata Hodovan <rhodovan.u-szeged> | ||||||
Component: | CSS | Assignee: | Renata Hodovan <rhodovan.u-szeged> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | cmarcelo, koivisto, macpherson, menard, ojan.autocc, tony, webkit.review.bot, zimmermann | ||||||
Priority: | P1 | Keywords: | Regression | ||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Bug Depends on: | |||||||||
Bug Blocks: | 116980 | ||||||||
Attachments: |
|
Description
Renata Hodovan
2012-12-18 03:42:23 PST
Maybe we could simply extend it to if(contextSytleSheet && parseKeyWordValue()) {} in parseValue(). But I'm not really familiar with CSS. Ideas? We get the same crash with <set> svg tag too: <svg xmlns="http://www.w3.org/2000/svg"> <rect> <set attributeName="display" to="round"></set> </rect> </svg> Created attachment 179965 [details]
Speculative fix
Maybe I should add a new test case too (?).
Regressed in <http://trac.webkit.org/changeset/118044>. Comment on attachment 179965 [details] Speculative fix View in context: https://bugs.webkit.org/attachment.cgi?id=179965&action=review > Source/WebCore/ChangeLog:10 > + No new tests (OOPS!). Please add a test. Comment on attachment 179965 [details] Speculative fix View in context: https://bugs.webkit.org/attachment.cgi?id=179965&action=review > Source/WebCore/css/CSSParser.cpp:1232 > - if (parseKeywordValue(declaration, propertyID, string, important, contextStyleSheet->parserContext())) > + if (contextStyleSheet && parseKeywordValue(declaration, propertyID, string, important, contextStyleSheet->parserContext())) I don't think this is correct. A few lines below, we create a CSSParserContext or use contextStyleSheet->parserContext() if it's available. We should try moving that code block here. This might have a perf impact. Try running run-perf-tests Dromaeo/jslib-style-prototype to check. Created attachment 180052 [details]
Proposed patch
(In reply to comment #6) > (From update of attachment 179965 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=179965&action=review > > > Source/WebCore/css/CSSParser.cpp:1232 > > - if (parseKeywordValue(declaration, propertyID, string, important, contextStyleSheet->parserContext())) > > + if (contextStyleSheet && parseKeywordValue(declaration, propertyID, string, important, contextStyleSheet->parserContext())) > > I don't think this is correct. A few lines below, we create a CSSParserContext or use contextStyleSheet->parserContext() if it's available. We should try moving that code block here. This might have a perf impact. Try running run-perf-tests Dromaeo/jslib-style-prototype to check. I've runned both versions a few times and it's seems that there is no measureable difference between them (+/-1 %). This way I choosed you idea. Comment on attachment 180052 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=180052&action=review > LayoutTests/fast/css/invalid-parsercontext-valid-keyword-crash-expected.txt:1 > +Excellent - did not crash. See bug https://bugs.webkit.org/show_bug.cgi?id=105275 Nit: Normally we write something like "This test passes if it does not crash." or just PASS, but this is also OK. > LayoutTests/fast/css/invalid-parsercontext-valid-keyword-crash.svg:10 > + testRunner.dumpAsText(); Please indent the dumpAsText() line 4 more spaces. Committed r138141: <http://trac.webkit.org/changeset/138141> |