1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-22 07:37:38 +01:00

unw_is_signal_frame should return false/0 for bad addresses

access_mem() could fail and return a non-zero value, which callers
interpret as boolean true.

Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
This commit is contained in:
dave lerner 2013-03-07 12:25:19 -06:00 committed by Arun Sharma
parent 679b65cd22
commit 8028a537dd

View file

@ -57,10 +57,11 @@ unw_is_signal_frame (unw_cursor_t *cursor)
if SA_SIGINFO is specified.
*/
ip = c->dwarf.ip;
if ((ret = (*a->access_mem) (as, ip, &w0, 0, arg)) < 0
|| (ret = (*a->access_mem) (as, ip + 4, &w1, 0, arg)) < 0)
return ret;
ret = ((w0 == 0x0077b858 && w1 == 0x80cd0000)
if ((*a->access_mem) (as, ip, &w0, 0, arg) < 0
|| (*a->access_mem) (as, ip + 4, &w1, 0, arg) < 0)
ret = 0;
else
ret = ((w0 == 0x0077b858 && w1 == 0x80cd0000)
|| (w0 == 0x0000adb8 && (w1 & 0xffffff) == 0x80cd00));
Debug (16, "returning %d\n", ret);
return ret;