Encrypted PDFs inside <embed> or <object> crash the Web Content process
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Feb 2019 23:08:26 +0000 (23:08 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Feb 2019 23:08:26 +0000 (23:08 +0000)
commit490b1ebc1da3e4aba64ebfa96c4a342dfc2a043b
tree7694f8cf5fad6d6fb1d9984ba48162afd6d8ba3e
parent16be377c4d36e7918f6708ce8657d16ad207a6bc
Encrypted PDFs inside <embed> or <object> crash the Web Content process
https://bugs.webkit.org/show_bug.cgi?id=194605
<rdar://problem/19894818>

Reviewed by Andy Estes.

Source/WebKit:

* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::createPasswordEntryForm):
Don't try to create a password form field if we can't make form fields.

This means you will be left with a useless embedded PDF, but at least
the Web Content process won't crash.

We'll need to find an alternative implementation of PDF embedded form
fields that is compatible with <embed> and <object> if we want to support
this. Currently we piggy-back off the fact that we can just insert
<input>s into the PluginDocument's DOM, but we can't do that if there
is no PluginDocument, just a main document, like in the <embed> case.

LayoutTests:

* fast/replaced/encrypted-pdf-as-object-and-embed-expected.txt: Added.
* fast/replaced/encrypted-pdf-as-object-and-embed.html: Added.
* fast/replaced/resources/encrypted-image.pdf: Added.
Add a test ensuring that we don't crash with encrypted PDF in <object> or <embed>.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/replaced/encrypted-pdf-as-object-and-embed-expected.txt [new file with mode: 0644]
LayoutTests/fast/replaced/encrypted-pdf-as-object-and-embed.html [new file with mode: 0644]
LayoutTests/fast/replaced/resources/encrypted-image.pdf [new file with mode: 0644]
LayoutTests/platform/ios/fast/replaced/encrypted-pdf-as-object-and-embed-expected.txt [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm