RESOLVED FIXED 24398
BackForwardList doesn't initialize m_client, which causes a crash
https://bugs.webkit.org/show_bug.cgi?id=24398
Summary BackForwardList doesn't initialize m_client, which causes a crash
Marc-Antoine Ruel
Reported 2009-03-05 12:26:02 PST
In the chromium port, when loading test_shell with a svg file, reload the "page" will crash test_shell.
Attachments
proposed patch (1.29 KB, patch)
2009-03-05 12:26 PST, Marc-Antoine Ruel
no flags
Fixed ChangeLog (1.33 KB, patch)
2009-03-09 13:25 PDT, Marc-Antoine Ruel
fishd: review-
new patch file (1.32 KB, patch)
2009-03-13 11:22 PDT, Marc-Antoine Ruel
fishd: review+
Marc-Antoine Ruel
Comment 1 2009-03-05 12:26:40 PST
Created attachment 28315 [details] proposed patch
Mark Rowe (bdash)
Comment 2 2009-03-06 00:10:12 PST
The header for BackForwardList contains the following: #if PLATFORM(CHROMIUM) // Must be called before any other methods. void setClient(BackForwardListClient* client) { m_client = client; } #endif This implies that your code is using this class incorrectly. Of course, it may be that the existing design of the class is not ideal and it should be changed, but if that is the case the comment is no longer correct.
Marc-Antoine Ruel
Comment 3 2009-03-09 12:48:25 PDT
What is happening in that particular case is that SVGImage::dataChanged() creates a new dummy Page() which doesn't have any back-forward logic. I think null-initializing is fine in this case since ~Page() always calls m_backForwardList->close(). I can update the comment in BackForwardList.h for BackForwardListClient::setClient() to // Must be called before any other methods except close().
Darin Fisher (:fishd, Google)
Comment 4 2009-03-09 13:03:44 PDT
Comment on attachment 28315 [details] proposed patch >Index: WebCore/ChangeLog ... >+ Reviewed by NOBODY (OOPS!). >+ >+ Fix a crash when loading a non html page (like a svg file) in test_shell >+ and reloading the page. >+ >+ * history/BackForwardListChromium.cpp: please add a bug link to the ChangeLog. >Index: WebCore/history/BackForwardListChromium.cpp ... >+ if (m_client) >+ m_client->close(); we should probably null check each usage and probably add some ASSERTs. wdyt?
Marc-Antoine Ruel
Comment 5 2009-03-09 13:25:49 PDT
Created attachment 28418 [details] Fixed ChangeLog
Marc-Antoine Ruel
Comment 6 2009-03-09 13:27:45 PDT
I don't think it is a good idea to NULL check each functions and add ASSERTs. Having m_client null-initialized will help there and this was a very particular case. I looked at directly extracting m_client from m_page and it is very deep down multiple objects hierarchy.
Holger Freyther
Comment 7 2009-03-11 02:00:24 PDT
Please don't use NULL in C++ code.
Darin Fisher (:fishd, Google)
Comment 8 2009-03-12 11:33:41 PDT
Comment on attachment 28418 [details] Fixed ChangeLog >Index: WebCore/history/BackForwardListChromium.cpp ... >+ , m_client(NULL) As mentioned, this should be 0 instead of NULL. Please post a revised patch, and then LGTM.
Marc-Antoine Ruel
Comment 9 2009-03-13 11:22:22 PDT
Created attachment 28587 [details] new patch file Replace NULL with 0.
Darin Fisher (:fishd, Google)
Comment 10 2009-03-18 23:18:37 PDT
Hin-Chung Lam
Comment 11 2010-02-24 17:38:06 PST
*** Bug 24636 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.