pfalcon / idapython

Automatically exported from code.google.com/p/idapython
Other
18 stars 5 forks source link

GetFchunkAttr returns signed integer #52

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
== What steps will reproduce the problem?
    GetFchunkAttr(ea, FUNCATTR_START);

there are two manifestations of this problem

first, when the function should return BADADDR, it returns -1 instead:
this happens when    ea = an address outside of a function

second, when the function addess is >= 0x80000000, you get a negative value too.

one problem with that is that if you pass this value to a function like 
GetFlags, idapython terminates the script with an error:  overflowerror, arg1 
type of ea_t

== What is the expected output? What do you see instead?

i expect to see a unsigned positive integer as result, as i get from 
GetFunctionAttr(ea, FUNCATTR_START)

== What version of the product are you using? On what operating system?
 the idapython that came with ida5.7

Please provide any additional information below.

the problem seems to be in Eval, which always returns a signed integer.

one way of fixing this would be to add the following to idc.py, in 'def Eval'
        elif rv.vtype == '\x02': # long
            return rv.num if rv.num>=0 else rv.num+0x100000000;

another way of fixing this would be to add a python+swig implementation of 
GetFchunkAttr.

Original issue reported on code.google.com by willem.h...@gmail.com on 2 Jul 2010 at 2:52

GoogleCodeExporter commented 9 years ago
Please verify with r313

Original comment by elias.ba...@gmail.com on 2 Jul 2010 at 4:18

GoogleCodeExporter commented 9 years ago
thanks, problem confirmed solved.

Original comment by willem.h...@gmail.com on 2 Jul 2010 at 6:37