Bug 1442716 - [caps] Handle empty origin gracefully in FUZZING. r=baku
authorChristian Holler <choller@mozilla.com>
Fri, 02 Mar 2018 19:48:49 +0100
changeset 461793 23b9459e1db5a9a2096b37ae706b3a023b435505
parent 461792 b8f0901cc921872fe903a90a1fcab96b3aca2c24
child 461794 b3b9609544ec30fffe6efa6100db7fd4806b23bb
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1442716
milestone60.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 1442716 - [caps] Handle empty origin gracefully in FUZZING. r=baku
caps/nsJSPrincipals.cpp
--- a/caps/nsJSPrincipals.cpp
+++ b/caps/nsJSPrincipals.cpp
@@ -214,16 +214,22 @@ ReadPrincipalInfo(JSStructuredCloneReade
     } else if (aTag == SCTAG_DOM_CONTENT_PRINCIPAL) {
         OriginAttributes attrs;
         nsAutoCString spec;
         nsAutoCString originNoSuffix;
         if (!ReadPrincipalInfo(aReader, attrs, spec, originNoSuffix)) {
             return false;
         }
 
+#ifdef FUZZING
+        if (originNoSuffix.IsEmpty()) {
+          return false;
+        }
+#endif
+
         MOZ_DIAGNOSTIC_ASSERT(!originNoSuffix.IsEmpty());
 
         aInfo = ContentPrincipalInfo(attrs, originNoSuffix, spec);
     } else {
 #ifdef FUZZING
         return false;
 #else
         MOZ_CRASH("unexpected principal structured clone tag");