diff options
| author | G. Branden Robinson <g.branden.robinson@gmail.com> | 2025-11-09 06:38:20 -0600 |
|---|---|---|
| committer | Dan Cross <crossd@gmail.com> | 2025-11-09 14:25:48 -0500 |
| commit | f39a2407b6e6ace6af68e466bfa2f362b9a9dd36 (patch) | |
| tree | 0c8cf1a8b91d045e66cd20f92bb8059674a16f56 /src/cmd/plot/libplot/move.c | |
| parent | 37cd522b0a79b4f6b2b5d4b8d27667dea44f71d4 (diff) | |
troff: fix SIGFPE when using modulus operator
I uncovered this problem while writing unit tests for GNU troff's
delimited expression handling. Plan 9 troff's numeric expression
evaluator handles division by zero but not modulus by zero.
Fixes:
$ echo '.if %0%0% .tm true' | 9 troff
Floating point exception (core dumped)
$ echo '.if 1%0 .tm true' | 9 troff
Floating point exception (core dumped)
After this patch:
$ echo '.if %0%0% .tm true' | 9 troff
x T utf
x res 720 1 1
x init
troff: modulus by zero.; stdin:1
troff: modulus by zero.; stdin:1
x trailer
V0
x stop
$ echo '.if 1%0 .tm true' | 9 troff
x T utf
x res 720 1 1
x init
troff: modulus by zero.; stdin:1
x trailer
V0
x stop
Diffstat (limited to 'src/cmd/plot/libplot/move.c')
0 files changed, 0 insertions, 0 deletions