diff --git a/manticore/__main__.py b/manticore/__main__.py index a1e52c5..ee0c7a1 100644 --- a/manticore/__main__.py +++ b/manticore/__main__.py @@ -33,7 +33,7 @@ def parse_arguments(): parser.add_argument('--maxsymb', type=int, default=512, help='Maximun number of symbolic bytes to inject') parser.add_argument('--data', type=str, default='', help='Initial concrete concrete_data for the input symbolic buffer') - parser.add_argument('--env', type=str, nargs='+', default=[], + parser.add_argument('--env', type=str, nargs=1, default=[], help='Specify symbolic environment variable VARNAME=++++++') parser.add_argument('--policy', type=str, default='random', help='Search policy. random|adhoc|uncovered|dicount|icount|syscount|depth.'\ diff --git a/manticore/core/cpu/x86.py b/manticore/core/cpu/x86.py index 89b14d8..906b0e6 100644 --- a/manticore/core/cpu/x86.py +++ b/manticore/core/cpu/x86.py @@ -5111,8 +5111,8 @@ class X86Cpu(Cpu): dest.write(Operators.EXTRACT(src.read(), 64, 64)) else: assert src.size == 64 and dest.size == 128 - value = dest.read() & 0x00000000ffffffff #low part - dest.write(value | Operators.CONCAT(128, src.read(), 0)) + value = Operators.EXTRACT(dest.read(),0, 64) #low part + dest.write(Operators.CONCAT(128, src.read(), value)) @instruction def PSUBB(cpu, dest, src): @@ -5462,10 +5462,11 @@ class X86Cpu(Cpu): if (TEMP > 15) TEMP = 16; DEST = DEST << (TEMP * 8); ''' - # TODO(yan): verify correctness of the src extension/truncation - srcval = Operators.EXTRACT(src.read(), 0, 8) - temp = Operators.ITEBV(src.size, srcval > 15, 16, srcval) - val = dest.read() << (Operators.ZEXTEND(temp, dest.size)) + count = Operators.ZEXTEND(src.read(), dest.size*2) + byte_count = Operators.ITEBV(src.size*2, count > 15, 16, count) + bit_count = byte_count * 8 + val = Operators.ZEXTEND(dest.read(), dest.size*2) + val = val << (Operators.ZEXTEND(bit_count, dest.size*2)) dest.write(Operators.EXTRACT(val, 0, dest.size)) #FIXME diff --git a/tests/auto/make_tests.py b/tests/auto/make_tests.py index deb0787..d7ab766 100644 --- a/tests/auto/make_tests.py +++ b/tests/auto/make_tests.py @@ -26,9 +26,10 @@ for test in tests: print """ import unittest -from core.cpu.x86 import * -from core.smtlib import * -from core.memory import * +from manticore.core.cpu.x86 import * +from manticore.core.smtlib import Operators +from manticore.core.memory import * + class CPUTest(unittest.TestCase): class ROOperand(object): diff --git a/tests/test_dyn.py b/tests/test_dyn.py new file mode 100644 index 0000000..b54ff07 --- /dev/null +++ b/tests/test_dyn.py @@ -0,0 +1,4500 @@ + +import unittest +from manticore.core.cpu.x86 import * +from manticore.core.smtlib import Operators +from manticore.core.memory import * + + +class CPUTest(unittest.TestCase): + class ROOperand(object): + ''' Mocking class for operand ronly ''' + def __init__(self, size, value): + self.size = size + self.value = value + def read(self): + return self.value & ((1<