honggfuzz/0001-fix-some-m32-compilation-issues-type-casting.patch

50 lines
2.1 KiB
Diff
Raw Normal View History

From aa1c3ccd0f9e2ed884ba877f2153b40c1448e6b9 Mon Sep 17 00:00:00 2001
From: Robert Swiecki <robert@swiecki.net>
Date: Thu, 5 Mar 2020 14:40:05 +0100
Subject: [PATCH] fix some -m32 compilation issues (type casting)
---
linux/trace.c | 4 ++--
report.c | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/linux/trace.c b/linux/trace.c
index 5a99363..3a22234 100644
--- a/linux/trace.c
+++ b/linux/trace.c
@@ -531,7 +531,7 @@ static void arch_traceSaveData(run_t* run, pid_t pid) {
PLOG_W("Couldn't get siginfo for pid %d", pid);
}
- uint64_t crashAddr = (uint64_t)si.si_addr;
+ uint64_t crashAddr = (uint64_t)(uintptr_t)si.si_addr;
/* User-induced signals don't set si.si_addr */
if (SI_FROMUSER(&si)) {
crashAddr = 0UL;
@@ -571,7 +571,7 @@ static void arch_traceSaveData(run_t* run, pid_t pid) {
" instr: '%s'",
pid, si.si_signo, si.si_errno, si.si_code, si.si_addr, pc, crashAddr, instr);
- if (!SI_FROMUSER(&si) && pc && crashAddr < (uint64_t)run->global->linux.ignoreAddr) {
+ if (!SI_FROMUSER(&si) && pc && crashAddr < (uint64_t)(uintptr_t)run->global->linux.ignoreAddr) {
LOG_I("Input is interesting (%s), but the si.si_addr is %p (below %p), skipping",
util_sigName(si.si_signo), si.si_addr, run->global->linux.ignoreAddr);
return;
diff --git a/report.c b/report.c
index 65af26d..383b273 100644
--- a/report.c
+++ b/report.c
@@ -146,8 +146,7 @@ void report_appendReport(pid_t pid, run_t* run, funcs_t* funcs, size_t funcCnt,
run->report, sizeof(run->report), "STACK HASH: %016" PRIx64 "\n", run->backtrace);
util_ssnprintf(run->report, sizeof(run->report), "STACK:\n");
for (size_t i = 0; i < funcCnt; i++) {
- util_ssnprintf(
- run->report, sizeof(run->report), " <0x%016" PRIx64 "> ", (uint64_t)funcs[i].pc);
+ util_ssnprintf(run->report, sizeof(run->report), " <0x%016tx> ", (uintptr_t)funcs[i].pc);
util_ssnprintf(run->report, sizeof(run->report), "[func:%s file:%s line:%zu module:%s]\n",
funcs[i].func, funcs[i].file, funcs[i].line, funcs[i].module);
}
--
2.25.1