except: detect exception stack corruption

Valgrind found an invalid read in the capture from Bug 15173 which was
not detected by ASAN, probably because 'top' pointed to a valid stack
address. Try to catch such issues with an explicit invariant check.

Change-Id: I3e2d90f053209c133ea2edc9c7990a2fd39bd236
Ping-Bug: 15189
Reviewed-on: https://code.wireshark.org/review/30101
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Peter Wu 2018-10-09 19:58:10 +02:00 committed by Anders Broman
parent 353ad11974
commit 9c61757dc2
1 changed files with 1 additions and 0 deletions

View File

@ -260,6 +260,7 @@ void except_setup_try(struct except_stacknode *esn,
struct except_stacknode *except_pop(void)
{
struct except_stacknode *top = get_top();
assert (top->except_type == XCEPT_CLEANUP || top->except_type == XCEPT_CATCHER);
set_top(top->except_down);
return top;
}