9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] tbl fail
@ 2013-01-04 16:05 erik quanstrom
  0 siblings, 0 replies; only message in thread
From: erik quanstrom @ 2013-01-04 16:05 UTC (permalink / raw)
  To: 9fans

tbl's calculation for how many columns it can handle is
wrong.  sizeof(nregs) = nelem(nregs)*sizeof(char*).
it appears that tbl is assuming *2-byte pointers*!

huzzah!

- erik

/n/dump/2013/0104/sys/src/cmd/tbl/tr.c:20,26 - tr.c:20,26
  char	*
  reg(int col, int place)
  {
- 	if (sizeof(nregs) < 2 * 3 * qcol)
+ 	if(qcol*place+col >= nelem(nregs)-1)
  		error("Too many columns for registers");
  	return (nregs[qcol*place+col]);
  }



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-01-04 16:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-04 16:05 [9fans] tbl fail erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).