@bloodline and @Piru
Thank you for your posts, I will now reply to them in one go.
bloodline wrote:
There is no way to know what the programs are passing to each other.
One thing at a time. First we need to know where the pointers are, then I'll say about my ideas on how we can use this information.
Piru wrote:
And I answer again: No.
Please explain the reasoning behind your answer, a simple 'No' doesn't help me understand why you don't think there is a way to see pointers in binary code.
Whilst I wait for your explanation, I would like to ask you another question. How does a CPU know that a program is asking to set up a pointer?
bloodline wrote:
No way, period. You could make assumptions but at best you would only be right, less than 30% of the time.
ASM is closely linked to the structure of machine code, correct? Also, ASM strives for efficiency. I would argue that there are only so many ways to set a pointer in ASM efficiently, and therefore only so many binary structures we would need to scan for to get a higher accuracy than 30% (where you got that figure from I don't know). I found a couple of ways of setting pointers in x86 ASM (I'm assuming it's x86 ASM anyway) from this page (Google cache version):
cs.colgate.edu/faculty/nevison/cs201web/lectureNotes/arraysandpointers.ppt
========================
clear2:
add $t0, $a0, $zero # p = addr of array[0]
forp: sw $zero, 0($t0) # memory[p] = 0
addi $t0, $t0, 4 # p = p + 4
sll $t1, $a1, 2 # $t1 = 4 * size
add $t1, $t1, $a0 # $t1 = addr array[size]
slt $t2, $t0, $t1 # p < &array[size] ?
bne $t2, $zero, forp # if so, continue
endfor:
=========================
Pointer version assembly code
clear2:
add $t0, $a0, $zero # p = addr of array[0]
sll $t1, $a1, 2 # $t1 = 4 * size
add $t1, $t1, $a0 # $t1 = addr array[size]
forp: sw $zero, 0($t0) # memory[p] = 0
addi $t0, $t0, 4 # p = p + 4
slt $t2, $t0, $t1 # p < &array[size] ?
bne $t2, $zero, forp # if so, continue
endfor:
========================
Why is it impossible to scan for the binary versions of the ASM code above?