aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2016-01-16 04:38:19 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2016-01-16 04:38:19 +0000
commit83eb5a035858bca79d7a8ac589ae5b98fd8467c6 (patch)
tree45f7f5e67a67ee9f4da14fefddd832d74c8c746c
parentec7886c19b5853d27c37cfb269f70805e4296231 (diff)
downloadgcc-83eb5a035858bca79d7a8ac589ae5b98fd8467c6.zip
gcc-83eb5a035858bca79d7a8ac589ae5b98fd8467c6.tar.gz
gcc-83eb5a035858bca79d7a8ac589ae5b98fd8467c6.tar.bz2
PR diagnostic/68899: fix read-beyond-buffer when printing very wide source lines
gcc/ChangeLog: PR diagnostic/68899 * diagnostic-show-locus.c (layout::print_source_line): Move x offset of line until after call to get_line_width_without_trailing_whitespace. From-SVN: r232465
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/diagnostic-show-locus.c3
2 files changed, 8 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 409e981..cf04218 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2016-01-15 David Malcolm <dmalcolm@redhat.com>
+
+ PR diagnostic/68899
+ * diagnostic-show-locus.c (layout::print_source_line): Move x
+ offset of line until after call to
+ get_line_width_without_trailing_whitespace.
+
2016-01-15 Jeff Law <law@redhat.com>
PR tree-optimization/69270
diff --git a/gcc/diagnostic-show-locus.c b/gcc/diagnostic-show-locus.c
index 3ef0052..e323254 100644
--- a/gcc/diagnostic-show-locus.c
+++ b/gcc/diagnostic-show-locus.c
@@ -524,14 +524,13 @@ layout::print_source_line (int row, line_bounds *lbounds_out)
if (!line)
return false;
- line += m_x_offset;
-
m_colorizer.set_normal_text ();
/* We will stop printing the source line at any trailing
whitespace. */
line_width = get_line_width_without_trailing_whitespace (line,
line_width);
+ line += m_x_offset;
pp_space (m_pp);
int first_non_ws = INT_MAX;