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
This commit is contained in:
David Malcolm 2016-01-16 04:38:19 +00:00 committed by David Malcolm
parent ec7886c19b
commit 83eb5a0358
2 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -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;