From d865f6b5554c6adf04f0786b821ba4c07c12d48d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 16 Dec 2013 19:59:50 +0200 Subject: [PATCH] Fix bug #16165 with memory corruption by extend_face_to_end_of_line. src/xdisp.c (extend_face_to_end_of_line): Don't fill background of display margins on mode line, header line, and in the frame's tool-bar window. --- src/ChangeLog | 6 ++++++ src/xdisp.c | 31 +++++++++++++++++++------------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index e21ccc28996..baddc361f70 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2013-12-16 Eli Zaretskii + + * xdisp.c (extend_face_to_end_of_line): Don't fill background of + display margins on mode line, header line, and in the frame's + tool-bar window. (Bug#16165) + 2013-12-16 Andreas Schwab * gnutls.c (Fgnutls_boot): Properly check Flistp return value. diff --git a/src/xdisp.c b/src/xdisp.c index bd57dc9e278..450bf5c62dc 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -18863,19 +18863,26 @@ extend_face_to_end_of_line (struct it *it) it->glyph_row->glyphs[TEXT_AREA][0].face_id = face->id; it->glyph_row->used[TEXT_AREA] = 1; } - if (WINDOW_LEFT_MARGIN_WIDTH (it->w) > 0 - && it->glyph_row->used[LEFT_MARGIN_AREA] == 0) - { - it->glyph_row->glyphs[LEFT_MARGIN_AREA][0] = space_glyph; - it->glyph_row->glyphs[LEFT_MARGIN_AREA][0].face_id = face->id; - it->glyph_row->used[LEFT_MARGIN_AREA] = 1; - } - if (WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0 - && it->glyph_row->used[RIGHT_MARGIN_AREA] == 0) + /* Mode line and the header line don't have margins, and + likewise the frame's tool-bar window, if there is any. */ + if (!(it->glyph_row->mode_line_p + || (WINDOWP (f->tool_bar_window) + && it->w == XWINDOW (f->tool_bar_window)))) { - it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0] = space_glyph; - it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0].face_id = face->id; - it->glyph_row->used[RIGHT_MARGIN_AREA] = 1; + if (WINDOW_LEFT_MARGIN_WIDTH (it->w) > 0 + && it->glyph_row->used[LEFT_MARGIN_AREA] == 0) + { + it->glyph_row->glyphs[LEFT_MARGIN_AREA][0] = space_glyph; + it->glyph_row->glyphs[LEFT_MARGIN_AREA][0].face_id = face->id; + it->glyph_row->used[LEFT_MARGIN_AREA] = 1; + } + if (WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0 + && it->glyph_row->used[RIGHT_MARGIN_AREA] == 0) + { + it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0] = space_glyph; + it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0].face_id = face->id; + it->glyph_row->used[RIGHT_MARGIN_AREA] = 1; + } } #ifdef HAVE_WINDOW_SYSTEM if (it->glyph_row->reversed_p) -- 2.39.2