diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2011-09-20 13:13:23 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2011-09-20 13:13:23 +0000 |
commit | 230eaefdc1cd15357da254488c8718b2026f597f (patch) | |
tree | 4a710a906a2354a41b1cde25e9bf8fb1d7139dce /man_term.c | |
parent | ec760ca5e2ff2a1ab37653be558d6b2736219f4d (diff) | |
download | mandoc-230eaefdc1cd15357da254488c8718b2026f597f.tar.gz mandoc-230eaefdc1cd15357da254488c8718b2026f597f.tar.zst mandoc-230eaefdc1cd15357da254488c8718b2026f597f.zip |
When advancing the left margin, .RS also needs to reset the right margin
to the default and check that the left does not outgrow the right one.
Otherwise, the (rmargin >= offset) assertion fails in term_flushln().
Bug found and fix tested by kristaps@ with NetBSD slapo-retcode(5).
Diffstat (limited to 'man_term.c')
-rw-r--r-- | man_term.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.118 2011/09/20 09:02:23 schwarze Exp $ */ +/* $Id: man_term.c,v 1.119 2011/09/20 13:13:23 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -826,7 +826,8 @@ pre_RS(DECL_ARGS) sz = (size_t)ival; mt->offset += sz; - p->offset = mt->offset; + p->rmargin = p->maxrmargin; + p->offset = mt->offset < p->rmargin ? mt->offset : p->rmargin; if (++mt->lmarginsz < MAXMARGINS) mt->lmargincur = mt->lmarginsz; |