Bug 1496364 - Minor refactor to stop uninitialized variable warning r=handyman
authorChris Martin <cmartin@mozilla.com>
Thu, 18 Oct 2018 19:14:05 +0000
changeset 490373 5441249fe31416707df434bc6f886d923543de46
parent 490372 9b976167b45aa1ea14c163e0dd4480ec1439289b
child 490374 9a05c09af3770321c9d3acd89204ac62f3fb1878
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewershandyman
bugs1496364
milestone64.0a1
Bug 1496364 - Minor refactor to stop uninitialized variable warning r=handyman The compiler warns that jobLevel is uninitialized if none of the if-else conditions are true. Simply replacing the leading assert with a "else crash" tells the compiler that case will never actually happen. Differential Revision: https://phabricator.services.mozilla.com/D8841
security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp
--- a/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp
+++ b/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp
@@ -384,17 +384,19 @@ SandboxBroker::SetSecurityLevelForConten
     accessTokenLevel = sandbox::USER_LIMITED;
     initialIntegrityLevel = sandbox::INTEGRITY_LEVEL_LOW;
     delayedIntegrityLevel = sandbox::INTEGRITY_LEVEL_LOW;
   } else if (aSandboxLevel == 2) {
     jobLevel = sandbox::JOB_INTERACTIVE;
     accessTokenLevel = sandbox::USER_INTERACTIVE;
     initialIntegrityLevel = sandbox::INTEGRITY_LEVEL_LOW;
     delayedIntegrityLevel = sandbox::INTEGRITY_LEVEL_LOW;
-  } else if (aSandboxLevel == 1) {
+  } else {
+    MOZ_ASSERT(aSandboxLevel == 1);
+    
     jobLevel = sandbox::JOB_NONE;
     accessTokenLevel = sandbox::USER_NON_ADMIN;
     initialIntegrityLevel = sandbox::INTEGRITY_LEVEL_LOW;
     delayedIntegrityLevel = sandbox::INTEGRITY_LEVEL_LOW;
   }
 
   // If the process will handle file: URLs, don't allow settings that
   // block reads.