diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/valprint.c | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f35ba1b..6704916 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2014-08-19 Jan Kratochvil <jan.kratochvil@redhat.com> + + Fix -fsanitize=address on unreadable inferior strings. + * valprint.c (val_print_string): Fix access before BUFFER. + 2014-08-19 Simon Marchi <simon.marchi@ericsson.com> * target.c (target_struct_size): Remove. diff --git a/gdb/valprint.c b/gdb/valprint.c index d3ab267..a87d67c 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -2510,8 +2510,10 @@ val_print_string (struct type *elttype, const char *encoding, LEN is -1. */ /* Determine found_nul by looking at the last character read. */ - found_nul = extract_unsigned_integer (buffer + bytes_read - width, width, - byte_order) == 0; + found_nul = 0; + if (bytes_read >= width) + found_nul = extract_unsigned_integer (buffer + bytes_read - width, width, + byte_order) == 0; if (len == -1 && !found_nul) { gdb_byte *peekbuf; |