Bug#422712: gs-esp: pstoraster fails with signal 11 when printing cups testpage
severity 422712 wishlist
retitle 422712 pstoraster segfaults with ancient cups
tags 422712 - moreinfo
tags 422712 + upstream
quit
(-cc: the world since I have veered off topic)
Troy Rollo wrote:
> I do not recall the precise reasoning behind this, other than that at the time
> the patch seemed to make sense mathematically and without it there was a
> segmentation violation
[...]
> The code patched seems to attempt to constrain "lasty" to a position within
> the passed in "btile", vertically (that is, "btile->size.y").
That helps. If I understand correctly then
by = lasty % btile->size.y;
if (by < 0)
by += btile->size.y;
would be another way to convey the same thing.
The context is beyond my depth (and undercommented, I suppose).
wrap_shifted_cursor seems to do something complicated involving
tile_shift, so if I had to guess, the fix would be something like:
ptc->tile.shift = btile->shift;
by = lasty + btile->size.y;
if (by < 0)
by += btile->size.y;
bx = endx;
if (ptc->tile.shift) {
int quotient = lasty / btile->size.y;
if (lasty < 0)
quotient--;
bx += quotient * ptc->tile.shift;
}
bx %= tw;
if (bx < 0)
bx += tw;
What I had been hoping for was something like "lasty gets set using
this library call from CUPS, which used to return this out-of-range
but meaningful value but always returns nonnegative values now".
Oh, well.
Maybe it would make sense to do
if (by < 0)
... error out with a helpful message ...
I'm marking figuring this out as a wishlist bug for now.
Thanks again.
Jonathan
Reply to: