aboutsummaryrefslogtreecommitdiffstats
path: root/executor/executor.cc
diff options
context:
space:
mode:
authorAlexander Egorenkov <Alexander.Egorenkov@ibm.com>2020-06-25 20:50:10 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-06-25 21:14:42 +0200
commitac40b8cc849c3f4663295a1cc4d0a88fc400f5ef (patch)
tree6f5ab12557b71b16aa35382972393b588fc7103c /executor/executor.cc
parentadb7d9e67bb06e753b959ddb66c3286a96719525 (diff)
executor: fix write_output_64
The output pointer was not updated after writing. Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
Diffstat (limited to 'executor/executor.cc')
-rw-r--r--executor/executor.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/executor/executor.cc b/executor/executor.cc
index 19aa45e81..1a2b641ff 100644
--- a/executor/executor.cc
+++ b/executor/executor.cc
@@ -284,6 +284,8 @@ struct kcov_comparison_t {
bool operator<(const struct kcov_comparison_t& other) const;
};
+static_assert(sizeof(kcov_comparison_t) == 4 * sizeof(uint64), "invalid size of kcov_comparison_t");
+
struct feature_t {
const char* name;
void (*setup)();
@@ -1315,7 +1317,8 @@ uint32* write_output_64(uint64 v)
fail("output overflow: pos=%p region=[%p:%p]",
output_pos, output_data, (char*)output_data + kMaxOutput);
*(uint64*)output_pos = v;
- return output_pos + 2;
+ output_pos += 2;
+ return output_pos;
}
void write_completed(uint32 completed)
@@ -1327,6 +1330,9 @@ void write_completed(uint32 completed)
#if SYZ_EXECUTOR_USES_SHMEM
void kcov_comparison_t::write()
{
+ if (type > (KCOV_CMP_CONST | KCOV_CMP_SIZE_MASK))
+ fail("invalid kcov comp type %llx", type);
+
// Write order: type arg1 arg2 pc.
write_output((uint32)type);