Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(760)

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2811533002: Exclude files from FileSelectChooser if they can't convert to WebStrings. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 0bac45b820d0a3acd252cf705c0326a96ad2a634..4656db6f4f4857df6e80c84a94e0d4e4471c278c 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -3218,6 +3218,12 @@ void RenderFrameHostImpl::FilesSelectedInChooser(
->GetFileSystemContext();
// Grant the security access requested to the given files.
for (const auto& file : files) {
+ // We shouldn't be given a FilePath that can't survive the conversion to a
+ // WebString, which we can approximate with AsUTF8Unsafe. Blink won't be
+ // able to handle it, and we would kill the renderer when it claims to have
+ // chosen an empty file path.
+ DCHECK(!file.file_path.AsUTF8Unsafe().empty());
+
if (permissions == FileChooserParams::Save) {
ChildProcessSecurityPolicyImpl::GetInstance()->GrantCreateReadWriteFile(
GetProcess()->GetID(), file.file_path);
« chrome/browser/file_select_helper.cc ('K') | « chrome/browser/file_select_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698