Skip to content

Commit

Permalink
!fixup fix infinite loop when loading the environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Matheus Marchini committed Mar 20, 2018
1 parent cf25dd3 commit 63901e8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/node-constants.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <lldb/API/LLDB.h>
#include <set>

#include "src/llv8-inl.h"
#include "src/node-constants.h"
Expand Down Expand Up @@ -66,7 +67,13 @@ addr_t Environment::LoadCurrentEnvironment(Error& err) {
continue;
}
bool found = false;
std::set<uint64_t> visited_contexts;
while (!found) {
// Necessary to avoid an infinite loop.
if (visited_contexts.count(val.raw())) {
break;
}
visited_contexts.insert(val.raw());
v8::Context context(val);
v8::Value native = context.Native(v8_err);
if (v8_err.Success()) {
Expand Down

0 comments on commit 63901e8

Please sign in to comment.