From 3038726a5b9fef12bb78b6ea5dd593c1fbe853b7 Mon Sep 17 00:00:00 2001 From: feliam Date: Wed, 9 Mar 2016 22:14:51 -0300 Subject: [PATCH] Fix --- bindings/python/unicorn/unicorn.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bindings/python/unicorn/unicorn.py b/bindings/python/unicorn/unicorn.py index 01cbff13..aef9d996 100644 --- a/bindings/python/unicorn/unicorn.py +++ b/bindings/python/unicorn/unicorn.py @@ -246,6 +246,8 @@ class Uc(object): # write to a register def reg_write(self, reg_id, value): + reg = None + if self._arch == UC_ARCH_X86: if reg_id in [ x86_const.UC_X86_REG_IDTR, x86_const.UC_X86_REG_GDTR, x86_const.UC_X86_REG_LDTR, x86_const.UC_X86_REG_TR]: assert isinstance(value, tuple) and len(value)==4 @@ -258,7 +260,8 @@ class Uc(object): reg = uc_x86_float80() reg.mantissa = value[0] reg.exponent = value[1] - else: + + if reg is None: # convert to 64bit number to be safe reg = ctypes.c_int64(value)