fuzz_with_unicorn: Fix read-past-end access via jit_iter

This commit is contained in:
MerryMage 2018-02-12 19:52:51 +00:00
parent bfd3e30c75
commit ef02658049

View file

@ -150,7 +150,7 @@ static void RunTestInstance(const std::array<u64, 31>& regs, const std::array<Ve
auto uni_iter = uni_env.modified_memory.begin(); auto uni_iter = uni_env.modified_memory.begin();
auto jit_iter = jit_env.modified_memory.begin(); auto jit_iter = jit_env.modified_memory.begin();
while (uni_iter != uni_env.modified_memory.end() || jit_iter != jit_env.modified_memory.end()) { while (uni_iter != uni_env.modified_memory.end() || jit_iter != jit_env.modified_memory.end()) {
if (uni_iter == uni_env.modified_memory.end() || uni_iter->first > jit_iter->first) { if (uni_iter == uni_env.modified_memory.end() || (jit_iter != jit_env.modified_memory.end() && uni_iter->first > jit_iter->first)) {
fmt::print("{:016x}: {:02x} *\n", jit_iter->first, jit_iter->second); fmt::print("{:016x}: {:02x} *\n", jit_iter->first, jit_iter->second);
jit_iter++; jit_iter++;
} else if (jit_iter == jit_env.modified_memory.end() || jit_iter->first > uni_iter->first) { } else if (jit_iter == jit_env.modified_memory.end() || jit_iter->first > uni_iter->first) {