diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2009-02-11 16:07:28 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2009-02-11 16:07:28 +0000 |
commit | 42e2132c64c9935a31073fb5460ac5b14430b69b (patch) | |
tree | 2782d5a62a7d280febc768368d107346a2ab6193 /gdb | |
parent | 315aef0afc6a200427c4e11adef6cea6f3a2e6ec (diff) | |
download | gdb-42e2132c64c9935a31073fb5460ac5b14430b69b.zip gdb-42e2132c64c9935a31073fb5460ac5b14430b69b.tar.gz gdb-42e2132c64c9935a31073fb5460ac5b14430b69b.tar.bz2 |
Avoid NULL dereference.
* stack.c (return_command): Guard use of SYMBOL_TYPE (thisfun).
New variable func_type.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/stack.c | 11 |
2 files changed, 14 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index de85aa4..107c3e1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2009-02-11 Jim Meyering <meyering@redhat.com> + Jan Kratochvil <jan.kratochvil@redhat.com> + + Avoid NULL dereference. + * stack.c (return_command): Guard use of SYMBOL_TYPE (thisfun). + New variable func_type. + 2009-02-11 Pedro Alves <pedro@codesourcery.com> * gdbarch.c: Regenerate. diff --git a/gdb/stack.c b/gdb/stack.c index a1a7696..3bcf758 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1823,7 +1823,8 @@ return_command (char *retval_exp, int from_tty) is discarded, side effects such as "return i++" still occur. */ return_value = NULL; - else if (using_struct_return (SYMBOL_TYPE (thisfun), return_type)) + else if (thisfun != NULL + && using_struct_return (SYMBOL_TYPE (thisfun), return_type)) { query_prefix = "\ The location at which to store the function's return value is unknown.\n\ @@ -1856,10 +1857,12 @@ If you continue, the return value that you specified will be ignored.\n"; { struct type *return_type = value_type (return_value); struct gdbarch *gdbarch = get_regcache_arch (get_current_regcache ()); - gdb_assert (gdbarch_return_value (gdbarch, SYMBOL_TYPE (thisfun), - return_type, NULL, NULL, NULL) + struct type *func_type = thisfun == NULL ? NULL : SYMBOL_TYPE (thisfun); + + gdb_assert (gdbarch_return_value (gdbarch, func_type, return_type, NULL, + NULL, NULL) == RETURN_VALUE_REGISTER_CONVENTION); - gdbarch_return_value (gdbarch, SYMBOL_TYPE (thisfun), return_type, + gdbarch_return_value (gdbarch, func_type, return_type, get_current_regcache (), NULL /*read*/, value_contents (return_value) /*write*/); } |