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:
parent
c4e1263132
commit
9c3630e983
2 changed files with 6 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue