Module Name:    src
Committed By:   kamil
Date:           Mon Jun 25 18:41:25 UTC 2018

Modified Files:
        src/external/bsd/tmux/dist: window-copy.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/tmux/dist/window-copy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/tmux/dist/window-copy.c
diff -u src/external/bsd/tmux/dist/window-copy.c:1.7 src/external/bsd/tmux/dist/window-copy.c:1.8
--- src/external/bsd/tmux/dist/window-copy.c:1.7	Thu Oct 12 22:17:35 2017
+++ src/external/bsd/tmux/dist/window-copy.c	Mon Jun 25 18:41:25 2018
@@ -2418,12 +2418,11 @@ void
 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);
 }
 

Reply via email to