Hi. One obvious patch where we access src->lines one element after the end.
Survives gcov.exp tests, I'm going to install the patch. Martin gcc/ChangeLog: 2018-09-17 Martin Liska <mli...@suse.cz> PR gcov-profile/85871 * gcov.c (output_intermediate_file): Fix out of bounds access. --- gcc/gcov.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/gcov.c b/gcc/gcov.c index 6a24a320046..c6cf79b0f53 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -1085,7 +1085,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); } }