exported / paimei

Automatically exported from code.google.com/p/paimei
GNU General Public License v2.0
1 stars 0 forks source link

disasm_around causes an infinite loop #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Giving disasm_around a number less than five causes window_size to be
calculated to zero due to how Python processes numbers, e.g num_inst=1 ->
window_size = (num_inst/5)*64 -> window_size == 0. This is because Python
interprets the numbers as ints rather than recasting them to a more precise
float or double, resulting in 1/5 == 0.

What is the expected output? What do you see instead?
Given num_inst=1, the expected output is three assembly instructions-- one
at the address before, one at the current address, one at the next address.
The result is an infinite loop that halts debugging.

What version of the product are you using? On what operating system?
Most recent check-out, Windows Vista.

Please provide any additional information below.
You can work around this issue by passing a float rather than an int to the
disasm_around function (e.g., 1.0 instead of 1), forcing the window_size
calculation to return nonzero. Additionally, you can fix this issue by
changing the window_size instantiation line to divide by 5.0 rather than by 5.

Original issue reported on code.google.com by frank2%d...@gtempaccount.com on 20 Apr 2010 at 9:33

GoogleCodeExporter commented 9 years ago
Actually, it looks like you can't work around the issue by passing a float-- 
that
causes the data calculation to be a non-integer number, rendering disasm_around
unable to disassemble the data. Here's a diff that should fix the issue.

Original comment by frank2%d...@gtempaccount.com on 20 Apr 2010 at 9:47

Attachments:

GoogleCodeExporter commented 9 years ago
Rather than using floats, you can simply reverse the order of the 
multiplication and division.  However, the code will still crash when num_inst 
= 0.  To account for this, I use the following diff on my installation:

Original comment by philshi...@gmail.com on 12 Jun 2010 at 6:38

Attachments:

GoogleCodeExporter commented 9 years ago
fixed. should work now. disasm_around now returns correct value for num_inst == 
1,
an returns an error value for num_inst == 0  or any float value.

Original comment by my.name....@gmail.com on 1 Jan 2011 at 7:40

GoogleCodeExporter commented 9 years ago

Original comment by my.name....@gmail.com on 1 Jan 2011 at 7:41