fix some compiler warnings in 32-bit linux

This commit is contained in:
hexcoder-
2021-10-02 22:47:22 +02:00
parent d668f9697c
commit e80131bef5
8 changed files with 19 additions and 14 deletions

View File

@ -144,7 +144,7 @@ static void instrument_coverate_write_function(GumStalkerOutput *output) {
GumX86Writer *cw = output->writer.x86; GumX86Writer *cw = output->writer.x86;
GumAddress code_addr = 0; GumAddress code_addr = 0;
afl_log_code code = {0}; afl_log_code code = {0};
guint64 instrument_hash_zero = 0; /*guint64 instrument_hash_zero = 0;*/
if (current_log_impl == 0 || if (current_log_impl == 0 ||
!gum_x86_writer_can_branch_directly_between(cw->pc, current_log_impl) || !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 = gssize current_pc_value2 =
GPOINTER_TO_SIZE(&instrument_previous_pc) - 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 = gsize afl_area_ptr_value =
GPOINTER_TO_SIZE(__afl_area_ptr) - 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)); gum_x86_writer_put_bytes(cw, code.bytes, sizeof(afl_log_code));

View File

@ -44,8 +44,9 @@ static void gum_afl_stalker_backpatcher_notify(GumStalkerObserver *self,
sizeof(prefetch_data->backpatch_data) - prefetch_data->backpatch_size; sizeof(prefetch_data->backpatch_data) - prefetch_data->backpatch_size;
if (sizeof(gsize) + size > remaining) { return; } if (sizeof(gsize) + size > remaining) { return; }
*(gsize *)(&prefetch_data->backpatch_data[prefetch_data->backpatch_size]) = gsize *dst_backpatch_size = (gsize *)
size; &prefetch_data->backpatch_data[prefetch_data->backpatch_size];
*dst_backpatch_size = size;
prefetch_data->backpatch_size += sizeof(gsize); prefetch_data->backpatch_size += sizeof(gsize);
memcpy(&prefetch_data->backpatch_data[prefetch_data->backpatch_size], memcpy(&prefetch_data->backpatch_data[prefetch_data->backpatch_size],
@ -115,7 +116,8 @@ static void prefetch_read_patches(void) {
remaining > sizeof(gsize); remaining > sizeof(gsize);
remaining = prefetch_data->backpatch_size - offset) { 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); offset += sizeof(gsize);
if (prefetch_data->backpatch_size - offset < size) { if (prefetch_data->backpatch_size - offset < size) {

View File

@ -237,11 +237,11 @@
(note that if this value is changed, several areas in afl-cc.c, afl-fuzz.c (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! */ 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: */ /* 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: */ /* Block normalization steps for afl-tmin: */

View File

@ -184,7 +184,7 @@ static void read_initial_file(void) {
if (st.st_size >= TMIN_MAX_FILE) { 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);
} }

View File

@ -1348,7 +1348,7 @@ int main(int argc, char **argv_orig, char **envp) {
} else if (afl->q_testcase_max_cache_size < 2 * MAX_FILE) { } 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 (2 * MAX_FILE) % 1048576 == 0 ? (2 * MAX_FILE) / 1048576
: 1 + ((2 * MAX_FILE) / 1048576)); : 1 + ((2 * MAX_FILE) / 1048576));

View File

@ -413,7 +413,7 @@ static u32 read_file(u8 *in_file) {
if (!be_quiet && !quiet_mode) { 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); MAX_FILE);
} }

View File

@ -221,7 +221,7 @@ static void read_initial_file(void) {
if (st.st_size >= TMIN_MAX_FILE) { 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);
} }