forked from Imagelibrary/binutils-gdb
Don't reference past the end of the vector
An earlier change made find_source_lines read:
end = &data[size];
However, since 'size' is the size of the vector, this seems fishy.
More obviously ok is to compute the end of the data directly:
end = data.data () + size;
2018-02-09 Tom Tromey <tom@tromey.com>
* source.c (find_source_lines): Don't reference past the end of
the vector.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2018-02-09 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* source.c (find_source_lines): Don't reference past the end of
|
||||
the vector.
|
||||
|
||||
2018-02-09 Markus Metzger <markus.t.metzger@intel.com>
|
||||
|
||||
* remote.c (remote_btrace_maybe_reopen): Change error message.
|
||||
|
||||
@@ -1219,7 +1219,7 @@ find_source_lines (struct symtab *s, int desc)
|
||||
size = myread (desc, data.data (), size);
|
||||
if (size < 0)
|
||||
perror_with_name (symtab_to_filename_for_display (s));
|
||||
end = &data[size];
|
||||
end = data.data () + size;
|
||||
p = &data[0];
|
||||
line_charpos[0] = 0;
|
||||
nlines = 1;
|
||||
|
||||
Reference in New Issue
Block a user