Skip to content

Commit 63901e8

Browse files
author
Matheus Marchini
committed
!fixup fix infinite loop when loading the environment
1 parent cf25dd3 commit 63901e8

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/node-constants.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <lldb/API/LLDB.h>
2+
#include <set>
23

34
#include "src/llv8-inl.h"
45
#include "src/node-constants.h"
@@ -66,7 +67,13 @@ addr_t Environment::LoadCurrentEnvironment(Error& err) {
6667
continue;
6768
}
6869
bool found = false;
70+
std::set<uint64_t> visited_contexts;
6971
while (!found) {
72+
// Necessary to avoid an infinite loop.
73+
if (visited_contexts.count(val.raw())) {
74+
break;
75+
}
76+
visited_contexts.insert(val.raw());
7077
v8::Context context(val);
7178
v8::Value native = context.Native(v8_err);
7279
if (v8_err.Success()) {

0 commit comments

Comments
 (0)