Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/tmux/dist Avoid UB in tmux/window_copy_add_form...



details:   https://anonhg.NetBSD.org/src/rev/74b2ee6b4557
branches:  trunk
changeset: 320194:74b2ee6b4557
user:      kamil <kamil%NetBSD.org@localhost>
date:      Mon Jun 25 18:41:25 2018 +0000

description:
Avoid UB in tmux/window_copy_add_formats()

Do not perform NULL pointer arithmetics.

Reported with MKSANITIZER/UBSan.

The patch proposed by upstream https://github.com/tmux/tmux/issues/1382

diffstat:

 external/bsd/tmux/dist/window-copy.c |  3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diffs (17 lines):

diff -r b324c6a34216 -r 74b2ee6b4557 external/bsd/tmux/dist/window-copy.c
--- a/external/bsd/tmux/dist/window-copy.c      Mon Jun 25 18:36:36 2018 +0000
+++ b/external/bsd/tmux/dist/window-copy.c      Mon Jun 25 18:41:25 2018 +0000
@@ -2418,12 +2418,11 @@
 window_copy_add_formats(struct window_pane *wp, struct format_tree *ft)
 {
        struct window_copy_mode_data    *data = wp->modedata;
-       struct screen                   *s = &data->screen;
 
        if (wp->mode != &window_copy_mode)
                return;
 
-       format_add(ft, "selection_present", "%d", s->sel.flag);
+       format_add(ft, "selection_present", "%d", data->screen.sel.flag);
        format_add(ft, "scroll_position", "%d", data->oy);
 }
 



Home | Main Index | Thread Index | Old Index