diff options
| author | serpilliere <devnull@localhost> | 2011-08-09 15:13:55 +0200 |
|---|---|---|
| committer | serpilliere <devnull@localhost> | 2011-08-09 15:13:55 +0200 |
| commit | aba3f7b9b637ebb1ce0463053e9185d6c0fca1fc (patch) | |
| tree | eb033395f1914e2b982aba4ad233a52b7b3b2dcd /miasm/tools/emul_lib/libcodenat_interface.c | |
| parent | 9aa45f265e33cb7397c78470b7d1680f192c92df (diff) | |
| download | focaccia-miasm-aba3f7b9b637ebb1ce0463053e9185d6c0fca1fc.tar.gz focaccia-miasm-aba3f7b9b637ebb1ce0463053e9185d6c0fca1fc.zip | |
fix emulation on 64 bit
Diffstat (limited to 'miasm/tools/emul_lib/libcodenat_interface.c')
| -rw-r--r-- | miasm/tools/emul_lib/libcodenat_interface.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/miasm/tools/emul_lib/libcodenat_interface.c b/miasm/tools/emul_lib/libcodenat_interface.c index 17910a09..5482d931 100644 --- a/miasm/tools/emul_lib/libcodenat_interface.c +++ b/miasm/tools/emul_lib/libcodenat_interface.c @@ -786,7 +786,7 @@ PyObject* _vm_exec_blocs(PyObject* self, PyObject* args) PyObject* module; PyObject* func; PyObject* meip; - unsigned int tmp; + unsigned long tmp; PyObject* my_eip; PyObject* known_blocs; @@ -799,25 +799,30 @@ PyObject* _vm_exec_blocs(PyObject* self, PyObject* args) RAISE(PyExc_TypeError, "arg must be dict"); if (PyInt_Check(my_eip)){ - tmp = (unsigned int)PyInt_AsLong(my_eip); + tmp = (unsigned long)PyInt_AsLong(my_eip); } else if (PyLong_Check(my_eip)){ - tmp = (unsigned int)PyInt_AsUnsignedLongLongMask(my_eip); + tmp = (unsigned long)PyInt_AsUnsignedLongLongMask(my_eip); } else{ RAISE(PyExc_TypeError,"arg1 must be int"); } - meip = PyInt_FromLong((long)tmp); + meip = PyLong_FromUnsignedLong((unsigned long)tmp); while (1){ b = PyDict_GetItem(known_blocs, meip); if (b == NULL) return meip; + module = PyObject_GetAttrString(b, "module_c"); - if (module == NULL) - return meip; + if (module == NULL){ + printf("assert eip module_c in pyobject\n"); + exit(0); + } func = PyObject_GetAttrString(module, "func"); - if (func == NULL) - return meip; + if (func == NULL){ + printf("assert func module_c in pyobject\n"); + exit(0); + } Py_DECREF(module); if (!PyCallable_Check (func)) { |