aboutsummaryrefslogtreecommitdiffstats
path: root/executor/executor.cc
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@gmail.com>2017-02-08 18:40:46 +0100
committerGitHub <noreply@github.com>2017-02-08 18:40:46 +0100
commit8722e7a33ec75c19437127a5926b82cc48ff9ec3 (patch)
treed004778543ebef9d348e491f428d0de17d332b28 /executor/executor.cc
parente1091cba8e2ba2bfd1b097bda4f455a5da7507ac (diff)
parent0130c7b34e9e4e831c2794f00a0d017040a967a9 (diff)
Merge pull request #132 from xairy/tun-icmpv6
ICMPv6 descriptions
Diffstat (limited to 'executor/executor.cc')
-rw-r--r--executor/executor.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/executor/executor.cc b/executor/executor.cc
index bc8e949d9..7ab747c73 100644
--- a/executor/executor.cc
+++ b/executor/executor.cc
@@ -46,7 +46,7 @@ const int kMaxInput = 2 << 20;
const int kMaxOutput = 16 << 20;
const int kMaxArgs = 9;
const int kMaxThreads = 16;
-const int kMaxCommands = 4 << 10;
+const int kMaxCommands = 16 << 10;
const int kCoverSize = 64 << 10;
const int kPageSize = 4 << 10;
@@ -461,6 +461,8 @@ void handle_completion(thread_t* th)
fail("bad thread state in completion: ready=%d done=%d handled=%d",
th->ready, th->done, th->handled);
if (th->res != (uint64_t)-1) {
+ if (th->call_n >= kMaxCommands)
+ fail("result idx %ld overflows kMaxCommands", th->call_n);
results[th->call_n].executed = true;
results[th->call_n].val = th->res;
for (bool done = false; !done;) {
@@ -471,6 +473,8 @@ void handle_completion(thread_t* th)
char* addr = (char*)read_input(&th->copyout_pos);
uint64_t size = read_input(&th->copyout_pos);
uint64_t val = copyout(addr, size);
+ if (th->call_n >= kMaxCommands)
+ fail("result idx %ld overflows kMaxCommands", th->call_n);
results[th->call_n].executed = true;
results[th->call_n].val = val;
debug("copyout from %p\n", addr);