🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text
Article #5736

DWB 2.0 ditroff bug

#5736
From: Bill "Bill" Tuthill
Date: Tue, 31 Jan 1989 03:52
44 lines
1863 bytes
The ditroff (aka troff) in Documenter's WorkBench 2.0 core dumps
when a break and some text follow a \D draw command.  For example,
this input causes a core dump:

	\D'c 1i'
	.br
	a

Here is a fix, courtesy of Henry McGilton.  The core dump is caused
by an attempt to store a value in a negative (out-of-bounds) array
location.  The core dump actually occurs in the getcw() function,
although the bug is in the ptout0() function.  Note that only two
lines need to be added; lines marked ! are just indented further.

*** 302,313 ****
        if (k < 040 && k != DRAWFCN)
                return(outsize);
!       if (widcache[k-32].fontpts == (xfont<<8) + xpts  && !setwdf) {
!               w = widcache[k-32].width;
!               bd = 0;
!               cs = 0;
!       } else 
!               w = getcw(k-32);
        j = z = 0;
        if (k != DRAWFCN) {
--- 304,317 ----
        if (k < 040 && k != DRAWFCN)
                return(outsize);
+       if (k >= 32) {
!               if (widcache[k-32].fontpts == (xfont<<8) + xpts  && !setwdf) {
!                       w = widcache[k-32].width;
!                       bd = 0;
!                       cs = 0;
!               } else
!                       w = getcw(k-32);
+       }
        j = z = 0;
        if (k != DRAWFCN) {

The ditroff in DWB 1.0 has the same bug, but does not core dump
with the input given above because it tests, but does not store a
value in, the out-of-bounds array location.

Bill Tuthill
Technical Details
Message-ID: <87609@sun.uucp>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!lll-winken!ames!oliveb!sun!cairo!tut

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!lll-winken!ames!oliveb!sun!cairo!tut
From: tut%cairo@Sun.COM (Bill "Bill" Tuthill)
Newsgroups: comp.text,comp.bugs.sys5
Subject: DWB 2.0 ditroff bug
Message-ID: <87609@sun.uucp>
Date: 31 Jan 89 03:52:15 GMT
Sender: news@sun.uucp
Lines: 44