From: dmalcolm Date: Sat, 16 Jan 2016 04:38:19 +0000 (+0000) Subject: PR diagnostic/68899: fix read-beyond-buffer when printing very wide source lines X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=12634056143af6f7826389344e4b5ee4c1dddbd5;p=thirdparty%2Fgcc.git 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232465 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 409e98133875..cf0421880c0f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-01-15 David Malcolm + + 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 PR tree-optimization/69270 diff --git a/gcc/diagnostic-show-locus.c b/gcc/diagnostic-show-locus.c index 3ef00525ed82..e32325486af9 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;