Bug 1472681: Fix NULL_DEREFERENCE error in js/src/vm/EnvironmentObject-inl.h. r=luke
authorRobert Bartlensky <rbartlensky@mozilla.com>
Thu, 19 Jul 2018 11:16:42 +0100
changeset 427946 06b69c1525d00ed5eba203c523b061fd210def1d
parent 427945 57d01bdce6b86840f4567d8d68b61d893369a849
child 427947 873b3e2c3d2b1c619a839ce64635fc1daec53d0a
push id105593
push userrgurzau@mozilla.com
push dateTue, 24 Jul 2018 09:55:14 +0000
treeherdermozilla-inbound@f636b99a8091 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1472681
milestone63.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 1472681: Fix NULL_DEREFERENCE error in js/src/vm/EnvironmentObject-inl.h. r=luke MozReview-Commit-ID: 9p8jbWeZvhg
js/src/vm/EnvironmentObject-inl.h
--- a/js/src/vm/EnvironmentObject-inl.h
+++ b/js/src/vm/EnvironmentObject-inl.h
@@ -12,18 +12,21 @@
 #include "vm/JSObject-inl.h"
 #include "vm/TypeInference-inl.h"
 
 namespace js {
 
 inline LexicalEnvironmentObject&
 NearestEnclosingExtensibleLexicalEnvironment(JSObject* env)
 {
-    while (!IsExtensibleLexicalEnvironment(env))
+    MOZ_ASSERT(env);
+    while (!IsExtensibleLexicalEnvironment(env)) {
         env = env->enclosingEnvironment();
+        MOZ_ASSERT(env);
+    }
     return env->as<LexicalEnvironmentObject>();
 }
 
 inline void
 EnvironmentObject::setAliasedBinding(JSContext* cx, uint32_t slot, PropertyName* name,
                                      const Value& v)
 {
     if (isSingleton()) {