The only possible situation here is that block2 or block3 are overflowing a variable on your function's stack and your
y var is being changed.
A function's stack is composed (growing from high memory to low memory) by
variables (in reverse order),
eip,
esp, function name and
esp.
Here is a simple example for your possible situation:
Code:
void of()
{
char a[10];
char b[10];
strcpy (a, "aaaaaaaaaa");
printf ("%s\n", a);
strcpy(b, "bbbbbbbbbboverflow");
printf ("%s\n", a);
}
void
main ()
{
of();
}
As you will be able to see, variable b overflows into variable a.