attempt to take address of function identifier produces address of jump table entry
Your code contains a statement or expression that tries to refer to the address of a function by taking the address of the function's identifier. When you take the address of a function you get the address of the jump table entry for the function, not the address of the function itself.
As an example of this condition, consider this code fragment:
void func(void) {}
.
.
.
int in_func(char *ptr)
{
if (ptr > (char *)&func && ptr < (char *)&func + 40)
{
// erroneously expects that ptr points within func()
return 1;
}
return 0;
}
Within the expression:
(ptr > (char *)&func && ptr < (char *)&func + 40)
the result of &func
is the address of the jump table entry for func()
, not the address of func()
itself. Hence the expression does not determine whether or not ptr
is within the first 40 bytes of func()
; but instead determines whether or not ptr
is within the 40 bytes following the jump table entry for func()
, which is not what was intended.