Bug 1288021: When we have a network GMP path fix the format for the sandbox rule. r=cpearce
authorBob Owen <bobowencode@gmail.com>
Wed, 20 Jul 2016 09:20:30 +0100
changeset 305853 70a2074086327156d960bdcb84d5606ca9323ad8
parent 305852 e25f1a122d9dc433d907ec2d1a6c9108cb3fbec0
child 305854 d4ec1b2cf832673078935f9e57cff6061c1bec16
push id30472
push usercbook@mozilla.com
push dateThu, 21 Jul 2016 14:21:44 +0000
treeherdermozilla-central@29ead859749a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1288021
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1288021: When we have a network GMP path fix the format for the sandbox rule. r=cpearce 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());