From 7431a9bd1bdf0c8299672750e40e05c877eb102c Mon Sep 17 00:00:00 2001 From: Alex Groce Date: Tue, 1 Jan 2019 01:20:09 -0700 Subject: [PATCH] fix OBOB, increase length since this may be what slowed manticore down --- examples/Runlen.cpp | 2 +- src/lib/DeepState.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/Runlen.cpp b/examples/Runlen.cpp index 42b86ee..235930a 100644 --- a/examples/Runlen.cpp +++ b/examples/Runlen.cpp @@ -37,7 +37,7 @@ char* decode(const char* output) { } // Can be (much) higher (e.g., > 1024) if we're using fuzzing, not symbolic execution -#define MAX_STR_LEN 2 +#define MAX_STR_LEN 3 TEST(Runlength, EncodeDecode) { char* original = DeepState_CStrUpToLen(MAX_STR_LEN, "ab"); diff --git a/src/lib/DeepState.c b/src/lib/DeepState.c index 036c843..9e17175 100644 --- a/src/lib/DeepState.c +++ b/src/lib/DeepState.c @@ -189,7 +189,7 @@ void DeepState_AssignCStr_C(char* str, size_t len, const char* allowed) { } else { uint32_t allowed_size = strlen(allowed); for (int i = 0; i < len; i++) { - str[i] = allowed[DeepState_UIntInRange(0, allowed_size)]; + str[i] = allowed[DeepState_UIntInRange(0, allowed_size-1)]; } } } @@ -212,7 +212,7 @@ char *DeepState_CStr_C(size_t len, const char* allowed) { } else { uint32_t allowed_size = strlen(allowed); for (int i = 0; i < len; i++) { - str[i] = allowed[DeepState_UIntInRange(0, allowed_size)]; + str[i] = allowed[DeepState_UIntInRange(0, allowed_size-1)]; } } } @@ -231,7 +231,7 @@ void DeepState_SymbolizeCStr_C(char *begin, const char* allowed) { uintptr_t begin_addr = (uintptr_t) begin; uintptr_t end_addr = (uintptr_t) (begin + strlen(begin)); for (uintptr_t i = 0, max_i = (end_addr - begin_addr); i < max_i; ++i) { - bytes[i] = allowed[DeepState_UIntInRange(0, allowed_size)]; + bytes[i] = allowed[DeepState_UIntInRange(0, allowed_size-1)]; } } }