|
From: <sv...@va...> - 2007-11-17 02:05:55
|
Author: sewardj
Date: 2007-11-17 02:05:57 +0000 (Sat, 17 Nov 2007)
New Revision: 7171
Log:
Stack registration stuff: don't dereference NULL pointers (Eric
Sharkey, #150044).
Modified:
trunk/coregrind/m_stacks.c
Modified: trunk/coregrind/m_stacks.c
===================================================================
--- trunk/coregrind/m_stacks.c 2007-11-17 01:49:06 UTC (rev 7170)
+++ trunk/coregrind/m_stacks.c 2007-11-17 02:05:57 UTC (rev 7171)
@@ -154,7 +154,7 @@
VG_(debugLog)(2, "stacks", "deregister stack %lu\n", id);
- if (current_stack->id == id) {
+ if (current_stack && current_stack->id == id) {
current_stack = NULL;
}
@@ -209,7 +209,8 @@
if (current_stack == NULL ||
new_SP < current_stack->start || new_SP > current_stack->end) {
Stack* new_stack = find_stack_by_addr(new_SP);
- if (new_stack && new_stack->id != current_stack->id) {
+ if (new_stack
+ && (current_stack == NULL || new_stack->id != current_stack->id)) {
/* The stack pointer is now in another stack. Update the current
stack information and return without doing anything else. */
current_stack = new_stack;
|