Export to GitHub

paimei - issue #15

basic block enumaration logical problem


Posted on Dec 11, 2010 by Quick Monkey

I am reporting 3 issues regarding basic block enumaration in the function __init_basic_blocks.

The 3 issues are posted seperately. Attached is a fix for the first and second issues.

The issues appear in pida/function.py in this version:

$Id: function.py 235 2009-10-17

I am using ida 5.5, but these are not idapython related issues.

Following is the first issue. the second and third issues are seperate.

In some cases, the Basic block enumeration may combine 2 or more basic blocks in to 1, returning them as a single block, and not mising some edges.

this issue will appear if pida is run on code containing a basic-block that is 1 opcode long, and has multiple xrefs both to it, and from it (or blocks to it && is a retn instruction). In this case the basic blocks could be combined.

for eg, for the following code:

cmp eax, esi jge label0 jmp label1 label0: cmp eax, esi label1: jz label2 nop nop nop label2: retn

a basic block will not be created for label1, instead a block will start at label 1 and finish at label2. A live version can be seen in windows 7, in tcpip.sys. on my computer it can be found by searching for the follwing text string:

push 1 push eax push offset aZwopenkey

or

C7 03 01 00 00 00 39 75 FC 74 0D 68 7C 34 0F

this issue can be fixed by changing the if order, and replacing the elifs with if's , like in the following line. In the attached fix I rewrote a part of the function, and fixed the problem (and the second posted isuue) diffrently.

Attachments

Comment #1

Posted on Jan 1, 2011 by Quick Monkey

(No comment was entered for this change.)

Status: Fixed

Labels:
Type-Defect Priority-Medium