fix some compiler warnings in 32-bit linux
MODIFY
frida_mode/src/instrument/instrument_x64.c
frida_mode/src/instrument/instrument_x64.c
@@ -144,7 +144,7 @@ static void instrument_coverate_write_function(GumStalkerOutput *output) {
GumX86Writer *cw = output->writer.x86;
GumAddress code_addr = 0;
afl_log_code code = {0};
- guint64 instrument_hash_zero = 0;
+ /*guint64 instrument_hash_zero = 0;*/
if (current_log_impl == 0 ||
!gum_x86_writer_can_branch_directly_between(cw->pc, current_log_impl) ||
@@ -183,7 +183,8 @@ static void instrument_coverate_write_function(GumStalkerOutput *output) {
}
- *((gint *)&code.bytes[patch_offset1]) = (gint)current_pc_value1;
+ gint *dst_pc_value = (gint *)&code.bytes[patch_offset1];
+ *dst_pc_value = (gint)current_pc_value1;
gssize current_pc_value2 =
GPOINTER_TO_SIZE(&instrument_previous_pc) -
@@ -200,7 +201,8 @@ static void instrument_coverate_write_function(GumStalkerOutput *output) {
}
- *((gint *)&code.bytes[patch_offset2]) = (gint)current_pc_value2;
+ dst_pc_value = (gint *)&code.bytes[patch_offset2];
+ *dst_pc_value = (gint)current_pc_value2;
gsize afl_area_ptr_value =
GPOINTER_TO_SIZE(__afl_area_ptr) -
@@ -217,7 +219,8 @@ static void instrument_coverate_write_function(GumStalkerOutput *output) {
}
- *((gint *)&code.bytes[afl_area_ptr_offset]) = (gint)afl_area_ptr_value;
+ gint *dst_afl_area_ptr_value = (gint *)&code.bytes[afl_area_ptr_offset];
+ *dst_afl_area_ptr_value = (gint)afl_area_ptr_value;
gum_x86_writer_put_bytes(cw, code.bytes, sizeof(afl_log_code));

MODIFY
frida_mode/src/prefetch.c
frida_mode/src/prefetch.c
@@ -44,8 +44,9 @@ static void gum_afl_stalker_backpatcher_notify(GumStalkerObserver *self,
sizeof(prefetch_data->backpatch_data) - prefetch_data->backpatch_size;
if (sizeof(gsize) + size > remaining) { return; }
- *(gsize *)(&prefetch_data->backpatch_data[prefetch_data->backpatch_size]) =
- size;
+ gsize *dst_backpatch_size = (gsize *)
+ &prefetch_data->backpatch_data[prefetch_data->backpatch_size];
+ *dst_backpatch_size = size;
prefetch_data->backpatch_size += sizeof(gsize);
memcpy(&prefetch_data->backpatch_data[prefetch_data->backpatch_size],
@@ -115,7 +116,8 @@ static void prefetch_read_patches(void) {
remaining > sizeof(gsize);
remaining = prefetch_data->backpatch_size - offset) {
- gsize size = *(gsize *)(&prefetch_data->backpatch_data[offset]);
+ gsize *src_backpatch_data = (gsize *)&prefetch_data->backpatch_data[offset];
+ gsize size = *src_backpatch_data;
offset += sizeof(gsize);
if (prefetch_data->backpatch_size - offset < size) {

MODIFY
include/config.h
include/config.h
(note that if this value is changed, several areas in afl-cc.c, afl-fuzz.c
and afl-fuzz-state.c have to be changed as well! */
-#define MAX_FILE (1 * 1024 * 1024U)
+#define MAX_FILE (1 * 1024 * 1024L)
/* The same, for the test case minimizer: */
-#define TMIN_MAX_FILE (10 * 1024 * 1024)
+#define TMIN_MAX_FILE (10 * 1024 * 1024L)
/* Block normalization steps for afl-tmin: */

MODIFY
src/afl-analyze.c
src/afl-analyze.c
@@ -184,7 +184,7 @@ static void read_initial_file(void) {
if (st.st_size >= TMIN_MAX_FILE) {
- FATAL("Input file is too large (%u MB max)", TMIN_MAX_FILE / 1024 / 1024);
+ FATAL("Input file is too large (%ld MB max)", TMIN_MAX_FILE / 1024 / 1024);
}

MODIFY
src/afl-fuzz.c
src/afl-fuzz.c
@@ -1348,7 +1348,7 @@ int main(int argc, char **argv_orig, char **envp) {
} else if (afl->q_testcase_max_cache_size < 2 * MAX_FILE) {
- FATAL("AFL_TESTCACHE_SIZE must be set to %u or more, or 0 to disable",
+ FATAL("AFL_TESTCACHE_SIZE must be set to %ld or more, or 0 to disable",
(2 * MAX_FILE) % 1048576 == 0 ? (2 * MAX_FILE) / 1048576
: 1 + ((2 * MAX_FILE) / 1048576));

MODIFY
src/afl-showmap.c
src/afl-showmap.c
@@ -413,7 +413,7 @@ static u32 read_file(u8 *in_file) {
if (!be_quiet && !quiet_mode) {
- WARNF("Input file '%s' is too large, only reading %u bytes.", in_file,
+ WARNF("Input file '%s' is too large, only reading %ld bytes.", in_file,
MAX_FILE);
}

MODIFY
src/afl-tmin.c
src/afl-tmin.c
@@ -221,7 +221,7 @@ static void read_initial_file(void) {
if (st.st_size >= TMIN_MAX_FILE) {
- FATAL("Input file is too large (%u MB max)", TMIN_MAX_FILE / 1024 / 1024);
+ FATAL("Input file is too large (%ld MB max)", TMIN_MAX_FILE / 1024 / 1024);
}

MODIFY
unicorn_mode/unicornafl
unicorn_mode/unicornafl
-Subproject commit c0e03d2c6b55a22025324f121746b41b1e756fb8
+Subproject commit 1c47d1ebc7e904ad4efc1370f23e269fb9ac3f93

fix some compiler warnings in 32-bit linux