From 3151451c87c91b305b524cb687570ac08ff2824e Mon Sep 17 00:00:00 2001 From: Hoang-Vu Dang Date: Mon, 4 Jul 2016 00:57:48 -0500 Subject: [PATCH] Fix some invalid code in regress --- tests/regress/jmp_ebx_hang.py | 8 ++++---- tests/regress/mov_gs_eax.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/regress/jmp_ebx_hang.py b/tests/regress/jmp_ebx_hang.py index 221765d9..5b3952c7 100755 --- a/tests/regress/jmp_ebx_hang.py +++ b/tests/regress/jmp_ebx_hang.py @@ -12,7 +12,7 @@ CODE = b'\xff\xe3' # jmp ebx class JumEbxHang(regress.RegressTest): def runTest(self): - mu = unicorn.Uc(unicorn.UC_ARCH_X86, unicorn.UC_MODE_32) + mu = unicorn.Uc(UC_ARCH_X86, UC_MODE_32) mu.mem_map(CODE_ADDR, 1024 * 4) mu.mem_write(CODE_ADDR, CODE) # If EBX is zero then an exception is raised, as expected @@ -22,10 +22,10 @@ class JumEbxHang(regress.RegressTest): with self.assertRaises(UcError) as m: mu.emu_start(CODE_ADDR, CODE_ADDR + 2, count=1) - self.assertEqual(m.exception.errno, unicorn.UC_ERR_FETCH_UNMAPPED) + self.assertEqual(m.exception.errno, UC_ERR_FETCH_UNMAPPED) print(">>> jmp ebx (ebx = 0xaa96a47f)"); - mu = unicorn.Uc(unicorn.UC_ARCH_X86, unicorn.UC_MODE_32) + mu = unicorn.Uc(UC_ARCH_X86, UC_MODE_32) mu.mem_map(CODE_ADDR, 1024 * 4) # If we write this address to EBX then the emulator hangs on emu_start mu.reg_write(unicorn.x86_const.UC_X86_REG_EBX, 0xaa96a47f) @@ -33,7 +33,7 @@ class JumEbxHang(regress.RegressTest): with self.assertRaises(UcError) as m: mu.emu_start(CODE_ADDR, CODE_ADDR + 2, count=1) - self.assertEqual(m.exception.errno, unicorn.UC_ERR_FETCH_UNMAPPED) + self.assertEqual(m.exception.errno, UC_ERR_FETCH_UNMAPPED) if __name__ == '__main__': regress.main() diff --git a/tests/regress/mov_gs_eax.py b/tests/regress/mov_gs_eax.py index 73fd6306..fb659da7 100755 --- a/tests/regress/mov_gs_eax.py +++ b/tests/regress/mov_gs_eax.py @@ -18,7 +18,7 @@ class VldrPcInsn(regress.RegressTest): # this should throw an error # the eax test is just to prove the second instruction doesn't execute try: - uc.emu_start(0x1000, len(code)) + uc.emu_start(0x1000, 0x1000 + len(code)) except UcError: return self.assertEqual(uc.reg_read(UC_X86_REG_EAX), 1)