Summary: | Crash when CSS selector is very long. | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Hayato Ito <hayato> | ||||||
Component: | CSS | Assignee: | Nobody <webkit-unassigned> | ||||||
Status: | NEW --- | ||||||||
Severity: | Normal | CC: | ahmad.saleem792, ap, bdakin, bfulgham, hayato, rniwa, simon.fraser, webkit-bug-importer, webkit.review.bot, zalan | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | PC | ||||||||
OS: | OS X 10.5 | ||||||||
Bug Depends on: | 43783, 43784 | ||||||||
Bug Blocks: | |||||||||
Attachments: |
|
Description
Hayato Ito
2010-07-21 23:08:23 PDT
Created attachment 62265 [details]
That would cause stack overflow
https://bugs.webkit.org/show_bug.cgi?id=41129 is a similar bug which was already fixed. We have to use an iterative approach instead of recursive one in order to avoid stack overflow. I found the following functions use recursion: - CSSSelector::specifity() - CSSStyleSelector::SelectorChecker::checkSelector() We need to investige further. There might be other functions which use recursion. Is there anyone working on fix this? If no one is working, I'll investigate the issue further. Created attachment 63988 [details]
make-checkSelector-iterative
I've made CSSStyleSelector::SelectorChecker::checkSelector() iterative to avoid stack overflow. To achieve it, I have to maintain CallStack manually. Hi reviewers, I am afraid the code became unintuitive. But I guess it is inevitable. If you have any ideas to make it clean and intuitive, please let me know. I also have a concern about performance. Is there any standard way to make sure a performance degradation won't happen by this change? I'll fix CSSSelector:specifity() in another patch later. That might be an pretty easy task. Attachment 63988 [details] did not pass style-queue:
Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
WebCore/css/CSSStyleSelector.cpp:1999: Non-label code inside switch statements should be indented. [whitespace/indent] [4]
WebCore/css/CSSStyleSelector.cpp:2092: Non-label code inside switch statements should be indented. [whitespace/indent] [4]
Total errors found: 2 in 6 files
If any of these errors are false positives, please file a bug against check-webkit-style.
I've canceled the review request. It might be better to make a couple of bugs to fix them separately step by step. I'd like to use this bug as a master bug to manage them. I've filed the bugs: - https://bugs.webkit.org/show_bug.cgi?id=43783 - https://bugs.webkit.org/show_bug.cgi?id=43784 I'll close this bug because all sub bugs are now fixed. If you find any other cases which causes a crash, please reopen this. https://bugs.webkit.org/show_bug.cgi?id=43783 is reopened. So this master bug should be also reopened. This test case is still crashing tab in Safari 15.6 on macOS 12.5 and after trying multiple refresh, you will notice that the banner "This web page..." starts to render slowly like 15 fps and does not show quickly before change the error to page body like "A problem ...". I think it might be good test case to improve "banner" loading performance of tab crash. |