Skip to content

Commit

Permalink
troff: line nr req .nm 1 causes div by 0 on .evc
Browse files Browse the repository at this point in the history
Fixes issue #75
  • Loading branch information
reffort committed Sep 3, 2018
1 parent a1db1a2 commit 0ac091c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions troff/n5.c
Expand Up @@ -1383,8 +1383,8 @@ evc(struct env *dp, struct env *sp)
if (dp->_brpnl < INT_MAX)
dp->_brpnl = 0;
dp->_nn = 0;
dp->_ndf = 0;
dp->_nms = 0;
dp->_ndf = 1;
dp->_nms = 1;
dp->_ni = 0;
dp->_ul = 0;
dp->_cu = 0;
Expand Down
2 changes: 1 addition & 1 deletion troff/n7.c
Expand Up @@ -292,7 +292,7 @@ donum(void)
nn--;
goto d1;
}
if (numtab[LN].val % ndf) {
if (numtab[LN].val % (ndf < 1 ? 1 : ndf)) {
numtab[LN].val++;
d1:
un += nw * (3 + nms + ni);
Expand Down

0 comments on commit 0ac091c

Please sign in to comment.