From a333e33c4f94d6b1cb4636de7d430e5e5757b228 Mon Sep 17 00:00:00 2001 From: robert-yates Date: Sat, 23 Nov 2024 19:02:49 +0100 Subject: [PATCH] fix warnings --- src/fuzzer/main.cpp | 2 +- src/fuzzing-engine/fuzzer.cpp | 2 +- src/unicorn-emulator/unicorn_x64_emulator.cpp | 10 ++++++---- src/windows-emulator/syscall_dispatcher.cpp | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/fuzzer/main.cpp b/src/fuzzer/main.cpp index de08863..e936dda 100644 --- a/src/fuzzer/main.cpp +++ b/src/fuzzer/main.cpp @@ -90,7 +90,7 @@ namespace restore_emulator(); - const auto memory = emu.emu().allocate_memory(page_align_up(std::max(data.size(), 1ULL)), + const auto memory = emu.emu().allocate_memory(page_align_up(std::max(data.size(), size_t(1))), memory_permission::read_write); emu.emu().write_memory(memory, data.data(), data.size()); diff --git a/src/fuzzing-engine/fuzzer.cpp b/src/fuzzing-engine/fuzzer.cpp index c207eca..78ab64f 100644 --- a/src/fuzzing-engine/fuzzer.cpp +++ b/src/fuzzing-engine/fuzzer.cpp @@ -123,7 +123,7 @@ namespace fuzzer const auto executions = context.executions.exchange(0); const auto highest_scorer = context.generator.get_highest_scorer(); const auto avg_score = context.generator.get_average_score(); - printf("Executions/s: %lld - Score: %llX - Avg: %.3f\n", executions, highest_scorer.score, avg_score); + printf("Executions/s: %zd - Score: %zX - Avg: %.3f\n", executions, highest_scorer.score, avg_score); } } } diff --git a/src/unicorn-emulator/unicorn_x64_emulator.cpp b/src/unicorn-emulator/unicorn_x64_emulator.cpp index f684819..dd12524 100644 --- a/src/unicorn-emulator/unicorn_x64_emulator.cpp +++ b/src/unicorn-emulator/unicorn_x64_emulator.cpp @@ -315,15 +315,17 @@ namespace unicorn mmio_write_callback write_cb) override { mmio_callbacks cb{ - .read = [c = std::move(read_cb)](uc_engine*, const uint64_t addr, const uint32_t s) + .read = mmio_callbacks::read_wrapper( + [c = std::move(read_cb)](uc_engine*, const uint64_t addr, const uint32_t s) { return c(addr, s); - }, - .write = [c = std::move(write_cb)](uc_engine*, const uint64_t addr, const uint32_t s, + }), + .write = mmio_callbacks::write_wrapper( + [c = std::move(write_cb)](uc_engine*, const uint64_t addr, const uint32_t s, const uint64_t value) { c(addr, s, value); - } + }) }; uce(uc_mmio_map(*this, address, size, cb.read.get_c_function(), cb.read.get_user_data(), diff --git a/src/windows-emulator/syscall_dispatcher.cpp b/src/windows-emulator/syscall_dispatcher.cpp index 0b8ab97..8990399 100644 --- a/src/windows-emulator/syscall_dispatcher.cpp +++ b/src/windows-emulator/syscall_dispatcher.cpp @@ -109,13 +109,13 @@ void syscall_dispatcher::dispatch(windows_emulator& win_emu) } catch (std::exception& e) { - printf("Syscall threw an exception: %X (0x%llX) - %s\n", syscall_id, address, e.what()); + printf("Syscall threw an exception: %X (0x%zX) - %s\n", syscall_id, address, e.what()); emu.reg(x64_register::rax, STATUS_UNSUCCESSFUL); emu.stop(); } catch (...) { - printf("Syscall threw an unknown exception: %X (0x%llX)\n", syscall_id, address); + printf("Syscall threw an unknown exception: %X (0x%zX)\n", syscall_id, address); emu.reg(x64_register::rax, STATUS_UNSUCCESSFUL); emu.stop(); }