Bug 140993

Summary: REGRESSION (r173698): Leaks of selector lists in CSS parsing
Product: WebKit Reporter: Darin Adler <darin>
Component: CSSAssignee: Darin Adler <darin>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, buildbot, commit-queue, kling, rniwa
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews100 for mac-mavericks
none
Archive of layout-test-results from ews106 for mac-mavericks-wk2
none
Patch
none
Patch none

Darin Adler
Reported 2015-01-28 00:53:26 PST
REGRESSION (r174245): Leaks of selector lists in CSS parsing
Attachments
Patch (4.95 KB, patch)
2015-01-28 00:54 PST, Darin Adler
no flags
Archive of layout-test-results from ews100 for mac-mavericks (617.54 KB, application/zip)
2015-01-28 01:45 PST, Build Bot
no flags
Archive of layout-test-results from ews106 for mac-mavericks-wk2 (745.34 KB, application/zip)
2015-01-28 01:51 PST, Build Bot
no flags
Patch (8.60 KB, patch)
2015-01-28 08:49 PST, Darin Adler
no flags
Patch (8.60 KB, patch)
2015-01-28 08:50 PST, Darin Adler
no flags
Darin Adler
Comment 1 2015-01-28 00:54:18 PST
Build Bot
Comment 2 2015-01-28 01:44:59 PST
Comment on attachment 245524 [details] Patch Attachment 245524 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/4614272839581696 New failing tests: fast/css/parsing-css-nth-child-of-3.html fast/css/parsing-css-nth-child-of-4.html fast/css/parsing-css-nth-last-child-of-3.html fast/css/parsing-css-nth-last-child-of-4.html
Build Bot
Comment 3 2015-01-28 01:45:01 PST
Created attachment 245526 [details] Archive of layout-test-results from ews100 for mac-mavericks The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-mavericks Platform: Mac OS X 10.9.5
Build Bot
Comment 4 2015-01-28 01:51:25 PST
Comment on attachment 245524 [details] Patch Attachment 245524 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/4873772884557824 New failing tests: fast/css/parsing-css-nth-child-of-3.html fast/css/parsing-css-nth-last-child-of-4.html fast/css/parsing-css-nth-last-child-of-3.html fast/css/parsing-css-nth-child-of-4.html
Build Bot
Comment 5 2015-01-28 01:51:27 PST
Created attachment 245527 [details] Archive of layout-test-results from ews106 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Darin Adler
Comment 6 2015-01-28 08:49:45 PST
Darin Adler
Comment 7 2015-01-28 08:50:25 PST
Darin Adler
Comment 8 2015-01-28 08:51:19 PST
The magic invalidSelectorList value made this much harder than I expected. This is really messy, and we should look for a better solution eventually, but I think my latest patch does correctly fix the problem.
WebKit Commit Bot
Comment 9 2015-01-28 09:50:01 PST
Comment on attachment 245547 [details] Patch Clearing flags on attachment: 245547 Committed r179258: <http://trac.webkit.org/changeset/179258>
WebKit Commit Bot
Comment 10 2015-01-28 09:50:05 PST
All reviewed patches have been landed. Closing bug.
Benjamin Poulain
Comment 11 2015-01-28 15:17:57 PST
Comment on attachment 245547 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=245547&action=review > Source/WebCore/css/CSSGrammar.y.in:1509 > + if ($4 != invalidSelectorVector) { I don't understand this check. An invalid :not() should have a null selector list, not an invalid one.
Darin Adler
Comment 12 2015-01-28 16:35:59 PST
Comment on attachment 245547 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=245547&action=review >> Source/WebCore/css/CSSGrammar.y.in:1509 >> + if ($4 != invalidSelectorVector) { > > I don't understand this check. An invalid :not() should have a null selector list, not an invalid one. You’re right. This check isn’t needed. Sorry! Feel free to remove it. I’d like to eventually follow this up with some more elegant scheme. I feel like the nth_selector_ending part of this is even more of a tightrope walk than the already-tricky lifetime management in this parser. Maybe we can require a newer version of yacc/bison and use fancier %union that works with C++ objects? Or find some other way to make this a little more foolproof. Maybe we should generate the parser with a completely different technology rather than yacc?
Benjamin Poulain
Comment 13 2015-01-28 18:18:08 PST
(In reply to comment #12) > Comment on attachment 245547 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=245547&action=review > > >> Source/WebCore/css/CSSGrammar.y.in:1509 > >> + if ($4 != invalidSelectorVector) { > > > > I don't understand this check. An invalid :not() should have a null selector list, not an invalid one. > > You’re right. This check isn’t needed. Sorry! Feel free to remove it. > > I’d like to eventually follow this up with some more elegant scheme. I feel > like the nth_selector_ending part of this is even more of a tightrope walk > than the already-tricky lifetime management in this parser. Maybe we can > require a newer version of yacc/bison and use fancier %union that works with > C++ objects? Or find some other way to make this a little more foolproof. > Maybe we should generate the parser with a completely different technology > rather than yacc? "nth_selector_ending" was not my favorite option. I wanted to separate the two :nth-child() at the "pseudo" level but bison refused to shift that for an unknown reason. Modern bison supports real LR(1) in addition LARL. That would simplify a bunch of stuff but LR(1) also create giant state machines so it may be terrible for performance. Personally, I would like us to use an hybrid LL parser for various reasons. Google is writing a new CSS parser for blink, I am curious to see what they do.
Note You need to log in before you can comment on or make changes to this bug.