aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcov.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2018-09-17 12:19:02 +0200
committerMartin Liska <marxin@gcc.gnu.org>2018-09-17 10:19:02 +0000
commitdda107dfb419d4272fdd10ccec93948d9fc7b6ba (patch)
treed096de0e505ee8acdeb287b296e79d58b86cea83 /gcc/gcov.c
parentdd1fd744cc939d763170aa80c3ee1a338742f5da (diff)
downloadgcc-dda107dfb419d4272fdd10ccec93948d9fc7b6ba.zip
gcc-dda107dfb419d4272fdd10ccec93948d9fc7b6ba.tar.gz
gcc-dda107dfb419d4272fdd10ccec93948d9fc7b6ba.tar.bz2
Fix out-of-bounds in gcov.c (PR gcov-profile/85871).
2018-09-17 Martin Liska <mliska@suse.cz> PR gcov-profile/85871 * gcov.c (output_intermediate_file): Fix out of bounds access. From-SVN: r264363
Diffstat (limited to 'gcc/gcov.c')
-rw-r--r--gcc/gcov.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/gcov.c b/gcc/gcov.c
index 64ab85c..c09d506 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -1097,7 +1097,8 @@ output_intermediate_file (FILE *gcov_file, source_info *src)
}
/* Follow with lines associated with the source file. */
- output_intermediate_line (gcov_file, &src->lines[line_num], line_num);
+ if (line_num < src->lines.size ())
+ output_intermediate_line (gcov_file, &src->lines[line_num], line_num);
}
}