diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-02-16 12:33:39 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-02-16 12:33:39 +0000 |
commit | 5d19971cac3813f20473e2e3588ff483ed6eb43f (patch) | |
tree | f83d24f49124633dfae76622661c0025d2931bb7 /man_term.c | |
parent | 43df6e40ec353f7e0699c6c633583fb632c6b760 (diff) | |
download | mandoc-5d19971cac3813f20473e2e3588ff483ed6eb43f.tar.gz |
when indenting, extend the right margin accordingly, when needed;
fixes a crash reported by blambert@ and a few other, similar ones
Diffstat (limited to 'man_term.c')
-rw-r--r-- | man_term.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2010, 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -658,7 +658,8 @@ pre_IP(DECL_ARGS) return(0); case (MAN_BODY): p->offset = mt->offset + len; - p->rmargin = p->maxrmargin; + p->rmargin = p->maxrmargin > p->offset ? + p->maxrmargin : p->offset; break; default: break; @@ -748,7 +749,8 @@ pre_TP(DECL_ARGS) return(0); case (MAN_BODY): p->offset = mt->offset + len; - p->rmargin = p->maxrmargin; + p->rmargin = p->maxrmargin > p->offset ? + p->maxrmargin : p->offset; p->trailspace = 0; p->flags &= ~TERMP_NOBREAK; break; @@ -909,8 +911,9 @@ pre_RS(DECL_ARGS) sz = (size_t)ival; mt->offset += sz; - p->rmargin = p->maxrmargin; - p->offset = mt->offset < p->rmargin ? mt->offset : p->rmargin; + p->offset = mt->offset; + p->rmargin = p->maxrmargin > p->offset ? + p->maxrmargin : p->offset; if (++mt->lmarginsz < MAXMARGINS) mt->lmargincur = mt->lmarginsz; |