Bug 1288021: When we have a network GMP path fix the format for the sandbox rule. draft
authorBob Owen <bobowencode@gmail.com>
Wed, 20 Jul 2016 09:20:30 +0100
changeset 389853 a93798c5033830ab7f3b2e32dfe5eca94e795304
parent 389550 5a91e5b49be3c1ba401b057e90c92d7488e3647d
child 525886 dd7dd01656a1050a62704916ebc7c65faf1a4b37
push id23550
push userbobowencode@gmail.com
push dateWed, 20 Jul 2016 08:25:29 +0000
bugs1288021
milestone50.0a1
Bug 1288021: When we have a network GMP path fix the format for the sandbox rule. MozReview-Commit-ID: BYMvKvwdFOK
dom/media/gmp/GMPProcessParent.cpp
--- a/dom/media/gmp/GMPProcessParent.cpp
+++ b/dom/media/gmp/GMPProcessParent.cpp
@@ -58,17 +58,30 @@ GMPProcessParent::Launch(int32_t aTimeou
   // The sandbox doesn't allow file system rules where the paths contain
   // symbolic links or junction points. Sometimes the Users folder has been
   // moved to another drive using a junction point, so allow for this specific
   // case. See bug 1236680 for details.
   if (!widget::WinUtils::ResolveMovedUsersFolder(wGMPPath)) {
     NS_WARNING("ResolveMovedUsersFolder failed for GMP path.");
     return false;
   }
-  mAllowedFilesRead.push_back(wGMPPath + L"\\*");
+
+  // If the GMP path is a network path that is not mapped to a drive letter,
+  // then we need to fix the path format for the sandbox rule.
+  wchar_t volPath[MAX_PATH];
+  if (::GetVolumePathNameW(wGMPPath.c_str(), volPath, MAX_PATH) &&
+      ::GetDriveTypeW(volPath) == DRIVE_REMOTE &&
+      wGMPPath.compare(0, 2, L"\\\\") == 0) {
+    std::wstring sandboxGMPPath(wGMPPath);
+    sandboxGMPPath.insert(1, L"??\\UNC");
+    mAllowedFilesRead.push_back(sandboxGMPPath + L"\\*");
+  } else {
+    mAllowedFilesRead.push_back(wGMPPath + L"\\*");
+  }
+
   args.push_back(WideToUTF8(wGMPPath));
 #else
   args.push_back(mGMPPath);
 #endif
 
   args.push_back(string(voucherPath.BeginReading(), voucherPath.EndReading()));
 
   return SyncLaunch(args, aTimeoutMs, base::GetCurrentProcessArchitecture());