Refactor new_symbolic_value (#48)

* Use default params instead of dict, add taint

* Update docstring
This commit is contained in:
Mark Mossberg
2017-03-03 18:22:04 -05:00
committed by GitHub
parent e49341c506
commit ab0abf7f72
+4 -5
View File
@@ -200,22 +200,21 @@ class State(object):
return expr
def new_symbolic_value(self, nbits, **options):
def new_symbolic_value(self, nbits, label='val', taint=frozenset()):
'''Create and return a symbolic value that is |nbits| bits wide. Assign
the value to a register or write it into the address space to introduce
it into the program state.
Args:
nbits - The bitwidth of the value returned.
options - Options to set on the returned expression. Valid options:
label -- The label to assign to the value.
label - The label to assign to the value.
taint - A tuple or frozenset of values to use as taint identifiers.
Returns:
Expression representing the value.
'''
assert nbits in (1, 4, 8, 16, 32, 64, 128, 256)
name = options.get('label', 'val')
expr = self.constraints.new_bitvec(nbits, name=name)
expr = self.constraints.new_bitvec(nbits, name=label, taint=taint)
self.input_symbols.append(expr)
return expr