]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix out-of-bounds in gcov.c (PR gcov-profile/85871).
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 Sep 2018 10:19:02 +0000 (10:19 +0000)
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 Sep 2018 10:19:02 +0000 (10:19 +0000)
2018-09-17  Martin Liska  <mliska@suse.cz>

PR gcov-profile/85871
* gcov.c (output_intermediate_file): Fix out of bounds
access.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@264363 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/gcov.c

index 44700f532425b04bc087568bb364889d821b6528..3b6af9ed48555a773f9fef9ba57fcd9b5cd181a1 100644 (file)
@@ -1,3 +1,9 @@
+2018-09-17  Martin Liska  <mliska@suse.cz>
+
+       PR gcov-profile/85871
+       * gcov.c (output_intermediate_file): Fix out of bounds
+       access.
+
 2018-09-17  Vineet Gupta  <vgupta@synopsys.com>
 
        * config/arc/arc.c: Object attributes for core4 not reflected
index 64ab85c981fe3d33773c15fcbefd71dc8162545e..c09d506005388df04163bb4c3fc3b2c95038b190 100644 (file)
@@ -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);
     }
 }