I got a really weird bug(?) on Win8x64 driver in C++, which crashes the system.
bool funcA(typedef1 arg1, typedef2 arg2)
{
funcB(arg1, arg2);
return true;
}
void funcB(typedef1 arg1, typedef2 arg2)
{
...do something
funcD(....)
....
}
Background info:
-- I did notice the driver crashes seemingly at random place of the codes, but didn't check why.
- I'm making some changes in "funcD()", not related to the crash.
- I compiled the binaries with debug, and noticed (now several time) that it crashes at the beginning of "funcB".
Problem:
The issue is with the address of "arg2". The correct "arg2" address is there inside "funcA", which calls "funcB". But once inside "funcB", the address for "arg2" gets truncated.
e.g. arg2 = 0xffffe000'01ace148 while in "funcA", which then passes to calling "funcB". But inside "funcB", it becomes arg2 = 0x00000000'01ace148
I really have no idea how this can happen, so any suggestion welcomed!
Don't think my changes in the downstream "funcD" could have caused this, yeah?
EDIT:
Both "typedefs" are pointer to some different structs.
Notice "funcA" doesn't do anything except calling "funcB" directly with the exact same arguments it receives. And both "funcA" and "funcB" have the same parameters (different return type tho), yet "funcA" has no problem receiving the arguments' addresses.