aboutsummaryrefslogtreecommitdiffstats
path: root/executor/executor.cc
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2017-02-08 15:48:58 +0100
committerAndrey Konovalov <andreyknvl@google.com>2017-02-08 15:48:58 +0100
commit8792b9237970ec1e93423de538bbe646a8ecff90 (patch)
tree79082f4db4a6f5a42e6db411a97cc8cd5d509f46 /executor/executor.cc
parente1091cba8e2ba2bfd1b097bda4f455a5da7507ac (diff)
executor: increase kMaxCommands and add checks
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);