diff options
author | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-01-16 04:38:19 +0000 |
---|---|---|
committer | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-01-16 04:38:19 +0000 |
commit | 12634056143af6f7826389344e4b5ee4c1dddbd5 (patch) | |
tree | 45f7f5e67a67ee9f4da14fefddd832d74c8c746c /gcc/diagnostic-show-locus.c | |
parent | 90153ae7a49d973b19f81271ef19404344536e5c (diff) | |
download | gcc-12634056143af6f7826389344e4b5ee4c1dddbd5.tar.gz |
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
Diffstat (limited to 'gcc/diagnostic-show-locus.c')
-rw-r--r-- | gcc/diagnostic-show-locus.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/gcc/diagnostic-show-locus.c b/gcc/diagnostic-show-locus.c index 3ef00525ed8..e32325486af 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; |