NEW 108931
Crash when loading MHTML including malformed Content-Type
https://bugs.webkit.org/show_bug.cgi?id=108931
Summary Crash when loading MHTML including malformed Content-Type
KwangYong Choi
Reported 2013-02-05 04:47:51 PST
MHTMLParser does not set main resource when it has malformed Content-Type. So, m_archive->mainResource() can be NULL.
Attachments
Patch (2.74 KB, patch)
2013-02-05 04:50 PST, KwangYong Choi
no flags
Patch (3.87 KB, patch)
2013-02-05 04:54 PST, KwangYong Choi
webkit.review.bot: commit-queue-
Patch (4.58 KB, patch)
2013-02-05 07:09 PST, KwangYong Choi
no flags
Patch (3.59 KB, patch)
2013-02-06 01:34 PST, KwangYong Choi
no flags
Patch (4.18 KB, patch)
2013-02-06 01:59 PST, KwangYong Choi
buildbot: commit-queue-
Patch (3.88 KB, patch)
2013-02-06 18:21 PST, KwangYong Choi
no flags
Patch (4.29 KB, patch)
2013-02-08 01:05 PST, KwangYong Choi
no flags
Patch (8.02 KB, patch)
2015-05-15 04:23 PDT, Csaba Osztrogonác
darin: review+
KwangYong Choi
Comment 1 2013-02-05 04:50:34 PST
KwangYong Choi
Comment 2 2013-02-05 04:54:04 PST
Created attachment 186602 [details] Patch Add missing files.
WebKit Review Bot
Comment 3 2013-02-05 05:37:06 PST
Comment on attachment 186602 [details] Patch Attachment 186602 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/16371745 New failing tests: mhtml/page_with_malformed_content_type.mht
KwangYong Choi
Comment 4 2013-02-05 06:09:27 PST
May I add empty pixel expectation for this test? In this test, I can not make testRunner.dumpAsText() call.
KwangYong Choi
Comment 5 2013-02-05 07:09:42 PST
Created attachment 186620 [details] Patch Add pixel expectation.
Adam Barth
Comment 6 2013-02-06 00:22:47 PST
Comment on attachment 186620 [details] Patch Perhaps we can use a ref test?
KwangYong Choi
Comment 7 2013-02-06 01:13:35 PST
(In reply to comment #6) > (From update of attachment 186620 [details]) > Perhaps we can use a ref test? Thank you for your idea. May I use an empty html file for ref?
KwangYong Choi
Comment 8 2013-02-06 01:34:31 PST
KwangYong Choi
Comment 9 2013-02-06 01:59:30 PST
Build Bot
Comment 10 2013-02-06 03:24:51 PST
KwangYong Choi
Comment 11 2013-02-06 18:21:07 PST
Created attachment 186972 [details] Patch Re-upload patch again because of win-ews false alarm.
KwangYong Choi
Comment 12 2013-02-07 04:17:08 PST
(In reply to comment #11) > Created an attachment (id=186972) [details] > Patch > > Re-upload patch again because of win-ews false alarm. cr-android-ews :(
KwangYong Choi
Comment 13 2013-02-08 01:05:48 PST
KwangYong Choi
Comment 14 2013-02-21 17:16:27 PST
Review?
Bem Jones-Bey
Comment 15 2014-04-17 16:23:42 PDT
Is this patch still needed?
Alexey Proskuryakov
Comment 16 2014-04-18 09:40:57 PDT
Seems like it's needed for MHTML support, but I'm not sure if any ports enable MHTML. Perhaps the whole feature should be removed? ENABLE_MHTML is never seen in sources, but it's in Tools/Scripts/webkitperl/FeatureList.pm: define => "ENABLE_MHTML", default => (isGtk() || isEfl()), value => \$mhtmlSupport }, What is this file used for? Does this mean that Gtk and Efl enable MHTML?
Bem Jones-Bey
Comment 17 2014-04-18 10:37:04 PDT
(In reply to comment #16) > Seems like it's needed for MHTML support, but I'm not sure if any ports enable MHTML. Perhaps the whole feature should be removed? > > ENABLE_MHTML is never seen in sources, but it's in Tools/Scripts/webkitperl/FeatureList.pm: > > define => "ENABLE_MHTML", default => (isGtk() || isEfl()), value => \$mhtmlSupport }, > > What is this file used for? Does this mean that Gtk and Efl enable MHTML? I'm not sure what that file is used for, but it is in some cmake build files as being turned on for EFL and Gtk: Source/cmake/OptionsEfl.cmake 80:WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML ON) Source/cmake/OptionsGTK.cmake 52:WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML ON) But it doesn't answer if they're actually using it in practice.
Chris Dumez
Comment 18 2014-04-18 10:55:07 PDT
(In reply to comment #17) > (In reply to comment #16) > > Seems like it's needed for MHTML support, but I'm not sure if any ports enable MHTML. Perhaps the whole feature should be removed? > > > > ENABLE_MHTML is never seen in sources, but it's in Tools/Scripts/webkitperl/FeatureList.pm: > > > > define => "ENABLE_MHTML", default => (isGtk() || isEfl()), value => \$mhtmlSupport }, > > > > What is this file used for? Does this mean that Gtk and Efl enable MHTML? > > I'm not sure what that file is used for, but it is in some cmake build files as being turned on for EFL and Gtk: > > Source/cmake/OptionsEfl.cmake > 80:WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML ON) > > Source/cmake/OptionsGTK.cmake > 52:WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML ON) > > But it doesn't answer if they're actually using it in practice. Gyuyoung should confirm but last I checked we were using MHTML. FYI, I believe I fixed this crash (and another one iirc) on Blink side: https://src.chromium.org/viewvc/blink?view=rev&revision=164584
Chris Dumez
Comment 19 2014-09-11 16:57:39 PDT
Comment on attachment 187262 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=187262&action=review > Source/WebCore/loader/DocumentLoader.cpp:498 > return false; If you clear m_archive here before returning, then you no longer need the fix in DocumentLoader::commitData(). See corresponding Blink fix: https://src.chromium.org/viewvc/blink?revision=164584&view=revision
Csaba Osztrogonác
Comment 20 2015-05-15 04:23:35 PDT
Darin Adler
Comment 21 2015-05-20 08:43:02 PDT
Comment on attachment 253191 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=253191&action=review I am OK with this change, but I think we can do better. > Source/WebCore/loader/DocumentLoader.cpp:970 > + if (!m_archive || !m_archive->mainResource()) { I suggest we make this fix inside ArchiveFactory::create. That function should never return an archive without a main resource. Further, the Archive class should be changed to have a reference for the main resource instead of a pointer. We don’t need to be able to create archives without main resources.
Note You need to log in before you can comment on or make changes to this bug.