go back to simple fix, but wrap when out of bounds and not symbolic

This commit is contained in:
Alex Groce
2018-12-05 20:54:11 -07:00
parent 827e4cbe82
commit c04168437b
+5 -4
View File
@@ -261,13 +261,14 @@ DEEPSTATE_INLINE static void DeepState_Check(int expr) {
return DeepState_ ## Tname ## InRange(high, low); \
} \
const tname x = DeepState_ ## Tname(); \
const tname size = (high - low) + 1; \
if (DeepState_UsingSymExec) { \
(void) DeepState_Assume(0 <= x && x < size); \
return low + x; \
(void) DeepState_Assume(low <= x && x <= high); \
} else { \
return low + (x % size); \
if ((x < low) || (x > high)) { \
const tname size = (high - low) + 1; \
x = low + (x % size); \
} \
return x; \
}
DEEPSTATE_MAKE_SYMBOLIC_RANGE(Size, size_t)