[comp.sys.hp] bug? -- XDrawLine can freeze HP-UX 6.5 X server

bill@boulder.Colorado.EDU (02/17/90)

  I think I've found something nasty, and I wonder if anybody
can tell me what's going wrong and what to do about it.

  I'm writing a program that does graphics in an X window,
and at a certain point, during an XDrawLine call, my
display freezes and I have no choice except to kill the
X server.  This is under HP-UX 6.5 -- we don't have 7.0
here yet; and it's on an HP 370.

  The arguments to XDrawLine (corresponding to
XDrawLine(display, d, gc, x1, y1, x2, y2)) are x1 = 19642,
y1 = 25985, x2 = -9529, y2 = -20184.  These numbers are very
big, of course, but I don't want to fool with them, because
with clipping it is possible that part of the line will pass
through my window.  Anyway, it doesn't seem reasonable for
bad arguments to a function to break the server.  (Incidentally,
I know the other arguments are correct.)

  Is this a server bug?  Can anyone from HP comment?

	-- Bill Skaggs

stroyan@hpfcso.HP.COM (Mike Stroyan) (02/19/90)

>   I'm writing a program that does graphics in an X window,
> and at a certain point, during an XDrawLine call, my
> display freezes and I have no choice except to kill the
> X server.  This is under HP-UX 6.5 -- we don't have 7.0
> here yet; and it's on an HP 370.

>   The arguments to XDrawLine (corresponding to
> XDrawLine(display, d, gc, x1, y1, x2, y2)) are x1 = 19642,
> y1 = 25985, x2 = -9529, y2 = -20184.  These numbers are very
> big, of course, but I don't want to fool with them, because
> with clipping it is possible that part of the line will pass
> through my window.  ...
  
>   Is this a server bug?  Can anyone from HP comment?
> 	-- Bill Skaggs

Yep, it's a server bug.  The Bresenham vector generator is overflowing
when computing the error term for very long lines.  The magnitude of the
error term exceeds 2^31, and sign errors can result in an infinite loop.
The problem was found after 7.0 went out.  It will be fixed in the next
release.  For now you can either-

1) Clip your lines to the window boundaries.
2) Use width 1 wide lines instead of width 0 lines.  (This will be slower.)
3) Talk to your HP service representative about getting a patched X server.

Mike Stroyan, stroyan@hpfcla.hp.com