aboutsummaryrefslogtreecommitdiff
path: root/gdb/source.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-02-09 05:58:46 -0700
committerTom Tromey <tom@tromey.com>2018-02-09 06:46:11 -0700
commit9c3630e983df43e68006b526a92c2a9a2b64dfd9 (patch)
tree7f95dd38a082ff70efd716fbc58b3ca40c158bc4 /gdb/source.c
parentc4e126313219ecde255a644a2c74008831edff5a (diff)
downloadgdb-9c3630e983df43e68006b526a92c2a9a2b64dfd9.zip
gdb-9c3630e983df43e68006b526a92c2a9a2b64dfd9.tar.gz
gdb-9c3630e983df43e68006b526a92c2a9a2b64dfd9.tar.bz2
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.
Diffstat (limited to 'gdb/source.c')
-rw-r--r--gdb/source.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/source.c b/gdb/source.c
index 9eec58f..009bec5 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -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;