From 4d6fa5ff6b23757ecf14e18ec4dc3285472346d3 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 15 Sep 2020 23:03:59 +0200 Subject: [PATCH] ex/ex_txt.c: txt_dent: introduce sequence point between decrement and access In particular, ensure the decrement is performed before the modulo is subtracted from "scno". Although most, if not all, compilers will perform the decrement first even in the original code, this is not guaranteed by the C language. Reported-by: David Binderman Signed-off-by: Sven Verdoolaege --- ex/ex_txt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ex/ex_txt.c b/ex/ex_txt.c index 1152d7f2..6e325111 100644 --- a/ex/ex_txt.c +++ b/ex/ex_txt.c @@ -394,7 +394,7 @@ txt_dent(SCR *sp, TEXT *tp) /* Get the previous shiftwidth column. */ cno = scno; - scno -= --scno % sw; + --scno, scno -= scno % sw; /* * Since we don't know what comes before the character(s) being -- 2.11.4.GIT