Date: Sat, 16 Feb 2013 12:48:06 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246874 - in head/contrib/nvi: ex vi Message-ID: <201302161248.r1GCm6Ro083677@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Sat Feb 16 12:48:06 2013 New Revision: 246874 URL: http://svnweb.freebsd.org/changeset/base/246874 Log: Fix two instances of undefined behaviour in contrib/nvi. Found by: clang ToT Obtained from: NetBSD Reviewed by: jh MFC after: 3 days Modified: head/contrib/nvi/ex/ex_txt.c head/contrib/nvi/vi/v_txt.c Modified: head/contrib/nvi/ex/ex_txt.c ============================================================================== --- head/contrib/nvi/ex/ex_txt.c Sat Feb 16 12:45:57 2013 (r246873) +++ head/contrib/nvi/ex/ex_txt.c Sat Feb 16 12:48:06 2013 (r246874) @@ -398,8 +398,8 @@ txt_dent(sp, tp) ++scno; /* Get the previous shiftwidth column. */ - cno = scno; - scno -= --scno % sw; + cno = scno--; + scno -= scno % sw; /* * Since we don't know what comes before the character(s) being Modified: head/contrib/nvi/vi/v_txt.c ============================================================================== --- head/contrib/nvi/vi/v_txt.c Sat Feb 16 12:45:57 2013 (r246873) +++ head/contrib/nvi/vi/v_txt.c Sat Feb 16 12:48:06 2013 (r246874) @@ -1956,8 +1956,10 @@ txt_dent(sp, tp, isindent) target = current; if (isindent) target += COL_OFF(target, sw); - else - target -= --target % sw; + else { + --target; + target -= target % sw; + } /* * The AI characters will be turned into overwrite characters if the
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302161248.r1GCm6Ro083677>