danigargu/heap-viewer

TypeError: Expected an ea_t type

fubuki8087 opened this issue · 3 comments

The plugin can't work on my IDA 7.0

Traceback (most recent call last):
  File "D:/software/IDA 7.0/plugins\heap_viewer\plugin_gui.py", line 139, in reload_gui_info
    self.populate_arenas()
  File "D:/software/IDA 7.0/plugins\heap_viewer\plugin_gui.py", line 165, in populate_arenas
    for addr, arena in self.heap.arenas():
  File "D:/software/IDA 7.0/plugins\heap_viewer\ptmalloc.py", line 642, in arenas
    arena = self.get_arena() # main_arena
  File "D:/software/IDA 7.0/plugins\heap_viewer\ptmalloc.py", line 619, in get_arena
    return get_struct(address, self.malloc_state_s)
  File "D:/software/IDA 7.0/plugins\heap_viewer\misc.py", line 25, in get_struct
    assert idaapi.is_loaded(address) == True, "Can't access memory at 0x%x" % address
  File "D:\software\IDA 7.0\python\ida_bytes.py", line 284, in is_loaded
    return _ida_bytes.is_loaded(*args)
TypeError: Expected an ea_t type

It seems a type error

I find if I started the plugin before the heap is initialized, the plugin will run successfully. The key problem is Reload. Once Reload triggered, no matter automatically or manually triggered, this exception will be prompted.

 When I use 

"libc_offsets": {
"32": {
"global_max_fast": 1784032,
"main_arena": 1779584,
"mp_": 1777952
},
"64": {
"global_max_fast": 3958776,
"main_arena": 3951392,
"mp_": 3948896
}
},
"libc_version": "2.23"

in files/config.json(After running "python get_config.py")
I met the same error as you do
So I go to check the config.py file
This is what I found :

with open(CONFIG_PATH, 'rb') as f:
config = json.loads(f.read())
xxxxxxxxx
m.libc_offsets = config.get('libc_offsets')
main_arena = None
malloc_par = None
if type(m.libc_offsets) is dict:
main_arena = m.libc_offsets.get("main_arena")
malloc_par = m.libc_offsets.get("mp_")
global_max_fast = m.libc_offsets.get("global_max_fast")

So I use

"libc_offsets": {
"global_max_fast": 3958776,
"main_arena": 3951392,
"mp_": 3948896
},

When analyzing 64-bit ELF 
After that, it works normally.

Hi, sorry for the delay.
I think I fixed the error in this commit: 3fdc15b

Could anyone try it?
Thanks! 👍