aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-08-31 13:12:59 +0200
committervan Hauser <vh@thc.org>2020-08-31 13:12:59 +0200
commitd2c9e4baa74210cf49243390fb3dabb29024ade4 (patch)
tree7995c97969fb7ac310d5884ad6547ee8cfa8385d
parent81767287c31f454271f62c24a8331f382e14bc85 (diff)
downloadafl++-d2c9e4baa74210cf49243390fb3dabb29024ade4.tar.gz
fix warnings and weird code insert
-rw-r--r--llvm_mode/afl-llvm-lto-instrumentation.so.cc24
-rw-r--r--src/afl-performance.c12
2 files changed, 25 insertions, 11 deletions
diff --git a/llvm_mode/afl-llvm-lto-instrumentation.so.cc b/llvm_mode/afl-llvm-lto-instrumentation.so.cc
index b8d9fce9..125db229 100644
--- a/llvm_mode/afl-llvm-lto-instrumentation.so.cc
+++ b/llvm_mode/afl-llvm-lto-instrumentation.so.cc
@@ -374,14 +374,28 @@ bool AFLLTOPass::runOnModule(Module &M) {
std::string Str1, Str2;
StringRef TmpStr;
bool HasStr1 = getConstantStringInfo(Str1P, TmpStr);
- if (TmpStr.empty())
+ if (TmpStr.empty()) {
+
HasStr1 = false;
- else
+
+ } else {
+
+ HasStr1 = true;
Str1 = TmpStr.str();
+
+ }
+
bool HasStr2 = getConstantStringInfo(Str2P, TmpStr);
- if (TmpStr.empty()) HasStr2 = false;
- (void)HasStr2 /* never read */
- else Str2 = TmpStr.str();
+ if (TmpStr.empty()) {
+
+ HasStr2 = false;
+
+ } else {
+
+ HasStr2 = true;
+ Str2 = TmpStr.str();
+
+ }
if (debug)
fprintf(stderr, "F:%s %p(%s)->\"%s\"(%s) %p(%s)->\"%s\"(%s)\n",
diff --git a/src/afl-performance.c b/src/afl-performance.c
index 0c1697a8..a9d7cefa 100644
--- a/src/afl-performance.c
+++ b/src/afl-performance.c
@@ -72,12 +72,12 @@ void jump(afl_state_t *afl) {
static const uint64_t JUMP[] = {0x180ec6d33cfd0aba, 0xd5a61266f0c9392c,
0xa9582618e03fc9aa, 0x39abdc4529b1661c};
- int i, b;
+ size_t i, b;
uint64_t s0 = 0;
uint64_t s1 = 0;
uint64_t s2 = 0;
uint64_t s3 = 0;
- for (i = 0; i < sizeof JUMP / sizeof *JUMP; i++)
+ for (i = 0; i < (sizeof(JUMP) / sizeof(*JUMP)); i++)
for (b = 0; b < 64; b++) {
if (JUMP[i] & UINT64_C(1) << b) {
@@ -110,12 +110,12 @@ void long_jump(afl_state_t *afl) {
static const uint64_t LONG_JUMP[] = {0x76e15d3efefdcbbf, 0xc5004e441c522fb3,
0x77710069854ee241, 0x39109bb02acbe635};
- int i, b;
+ size_t i, b;
uint64_t s0 = 0;
uint64_t s1 = 0;
uint64_t s2 = 0;
uint64_t s3 = 0;
- for (i = 0; i < sizeof LONG_JUMP / sizeof *LONG_JUMP; i++)
+ for (i = 0; i < (sizeof(LONG_JUMP) / sizeof(*LONG_JUMP)); i++)
for (b = 0; b < 64; b++) {
if (LONG_JUMP[i] & UINT64_C(1) << b) {
@@ -145,7 +145,7 @@ void long_jump(afl_state_t *afl) {
u32 hash32(u8 *key, u32 len, u32 seed) {
#else
-u32 inline hash32(u8 *key, u32 len, u32 seed) {
+inline u32 hash32(u8 *key, u32 len, u32 seed) {
#endif
@@ -157,7 +157,7 @@ u32 inline hash32(u8 *key, u32 len, u32 seed) {
u64 hash64(u8 *key, u32 len, u64 seed) {
#else
-u64 inline hash64(u8 *key, u32 len, u64 seed) {
+inline u64 hash64(u8 *key, u32 len, u64 seed) {
#endif