TooTallNate / ref

Turn Buffer instances into "pointers"
http://tootallnate.github.com/ref
453 stars 141 forks source link

ReadPointer only reinterpret_cast if not doing pointer arith, fixes #1 #2

Closed tjfontaine closed 12 years ago

tjfontaine commented 12 years ago

When doing the reinterpret_cast of the offset it changed the address of the new pointer, causing all sorts of havoc

ReadPointer 0x101816b00 + 0 -- 0x101816b00
Reinterpret_Cast 0x100a1a070
track 0 address 0x100a1a070
ReadPointer 0x101816b00 + 28 -- 0x101816b1c
Reinterpret_Cast 0xb7150000000001
track 1 address 0xb7150000000000

This change only does the reinterpret_cast if ReadPointer is called with a 0 offset

Fixes #1

tjfontaine commented 12 years ago

I lied, this of course does not actually fix the issue, it stopped a segfault and put the pointer nearer to where it should be but it's still not right.

tjfontaine commented 12 years ago

invalid, see #1 for the real fix