UNCONFIRMED103168
[WK2] Add null check and early return code before accessing member of m_iconDatabaseImpl if IconDatabase is not created yet
https://bugs.webkit.org/show_bug.cgi?id=103168
Summary [WK2] Add null check and early return code before accessing member of m_iconD...
Changhyup Jwa
Reported 2012-11-23 19:48:33 PST
If WebIconDatabase fails to create IconDatabase on WebIconDatabase::setDatabasePath(), m_iconDatabaseImpl references null. So, it is necessary to check null and early return before accessing m_iconDatabaseImpl.
Attachments
Patch (2.41 KB, patch)
2012-11-23 20:01 PST, Changhyup Jwa
no flags
Patch (2.14 KB, patch)
2012-11-25 17:52 PST, Changhyup Jwa
no flags
Patch (2.14 KB, patch)
2012-11-25 20:49 PST, Changhyup Jwa
andersca: review-
Changhyup Jwa
Comment 1 2012-11-23 20:01:21 PST
Andreas Kling
Comment 2 2012-11-23 22:06:32 PST
Comment on attachment 175847 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=175847&action=review > Source/WebKit2/UIProcess/WebIconDatabase.cpp:74 > m_iconDatabaseImpl = IconDatabase::create(); > + if (!m_iconDatabaseImpl) { How can this be null?
Alexey Proskuryakov
Comment 3 2012-11-23 23:25:23 PST
Failing to create an icon database is pretty much a fatal condition for a browser.
Changhyup Jwa
Comment 4 2012-11-25 17:38:27 PST
Comment on attachment 175847 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=175847&action=review >> Source/WebKit2/UIProcess/WebIconDatabase.cpp:74 >> + if (!m_iconDatabaseImpl) { > > How can this be null? Yes Andreas, you are right. It cannot be null. I'll make another patch immediately.
Changhyup Jwa
Comment 5 2012-11-25 17:52:07 PST
Brent Fulgham
Comment 6 2012-11-25 20:02:14 PST
Comment on attachment 175905 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=175905&action=review > Source/WebKit2/UIProcess/WebIconDatabase.cpp:267 > + if (!m_webContext || m_iconDatabaseImpl) Why do we exit early if m_iconDarabaseImpl exists?
Changhyup Jwa
Comment 7 2012-11-25 20:48:37 PST
Comment on attachment 175905 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=175905&action=review >> Source/WebKit2/UIProcess/WebIconDatabase.cpp:267 >> + if (!m_webContext || m_iconDatabaseImpl) > > Why do we exit early if m_iconDarabaseImpl exists? Thanks for your comment Brent, apologize for my mistake.
Changhyup Jwa
Comment 8 2012-11-25 20:49:53 PST
Anders Carlsson
Comment 9 2012-11-26 11:59:01 PST
Comment on attachment 175919 [details] Patch I agree with Alexey here, m_iconDatabaseImpl should never be null. If it is for some reason, then that underlying issue should be fixed instead of papering over it with random null checks.
Changhyup Jwa
Comment 10 2012-11-26 17:11:24 PST
(In reply to comment #9) > (From update of attachment 175919 [details]) > I agree with Alexey here, m_iconDatabaseImpl should never be null. If it is for some reason, then that underlying issue should be fixed instead of papering over it with random null checks. Thanks for your review, Anders :)
Note You need to log in before you can comment on or make changes to this bug.