mirror of
https://github.com/Vita3K/unicorn.git
synced 2024-11-23 13:29:40 +00:00
Fix some invalid code in regress
This commit is contained in:
parent
fa12de87f9
commit
3151451c87
@ -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()
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user