From dda107dfb419d4272fdd10ccec93948d9fc7b6ba Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 17 Sep 2018 12:19:02 +0200 Subject: Fix out-of-bounds in gcov.c (PR gcov-profile/85871). 2018-09-17 Martin Liska PR gcov-profile/85871 * gcov.c (output_intermediate_file): Fix out of bounds access. From-SVN: r264363 --- gcc/gcov.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/gcov.c') 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); } } -- cgit v1.1