Variable value can change when address is taken
rfalke opened this issue · comments
Source:
int main() {
int x=41;
inc(&x);
printf("The answer should be 42 and is %d\n", x);
return 0;
}
Output:
int32_t main() {
int32_t* v1;
v1 = reinterpret_cast<int32_t*>((reinterpret_cast<uint32_t>(__zero_stack_offset()) & 0xfffffff0) - 4 - 4 - 12);
inc(v1);
fun_8049040("The answer should be 42 and is %d\n", 41, 0x8049081, v1);
return 0;
}
The 41 in the printf call is wrong.
Also:
- doesn't recognize fun_8049040 as printf
- doesn't create a variable to hold the "real" value instead of some pointer.