Made the report function concretize using the minimizer, so that eventually we'll be able to compare inputs generated across tools

This commit is contained in:
Peter Goodman
2017-11-09 10:35:48 -05:00
parent 02fce4cdf9
commit 5f36822021
3 changed files with 14 additions and 2 deletions

View File

@@ -339,10 +339,12 @@ class DeepState(object):
LOGGER.critical("Test overflowed DeepState_Input symbol array")
input_length = len(symbols)
# Concretize the used symbols.
# Concretize the used symbols. We use `concretize_min` so that we're more
# likely to get the same concrete byte values across different tools (e.g.
# Manticore, Angr).
input_bytes = bytearray()
for i in xrange(input_length):
b = self.concretize(symbols[i], constrain=True)
b = self.concretize_min(symbols[i], constrain=True)
input_bytes.append(b)
# Print out each log entry.

View File

@@ -66,6 +66,9 @@ extern void *DeepState_ConcretizeData(void *begin, void *end);
/* Return a symbolic C string of length `len`. */
extern char *DeepState_CStr(size_t len);
/* Symbolize a C string */
void DeepState_SymbolizeCStr(char *begin);
/* Concretize a C string. Returns a pointer to the beginning of the
* concretized C string. */
extern const char *DeepState_ConcretizeCStr(const char *begin);

View File

@@ -107,6 +107,13 @@ char *DeepState_CStr(size_t len) {
return str;
}
/* Symbolize a C string */
void DeepState_SymbolizeCStr(char *begin) {
if (begin && begin[0]) {
DeepState_SymbolizeData(begin, begin + strlen(begin));
}
}
/* Concretize a C string */
const char *DeepState_ConcretizeCStr(const char *begin) {
return begin;