I just upgraded to 8.51 from 8.50 and epsonepl has stopped working with ghostscript segfaulting. I have tried removing the usual switches and gs 8.51 seems not to like "-sProcessColorModel=DeviceGray". It looks like the "fix" for bug 687013 had broken Gray devices - http://bugs.ghostscript.com/show_bug.cgi?id=687013 Am I being paranoid or that "gs_malloc(ijsdev->memory, sizeof(rgb), 1,..." line being obviously wrong? ('DeviceGray' is one character longer than 'DeviceRGB').
changing the malloc "sizeof(rgb)" to "sizeof(rgb) +2" doesn't help - still segfault; but that's the only change in gdevijs. Need to look further...
Sorry, I was right at the very beginning - the "fix" for bug 687013 is the problem. There are two ways of making it work without breaking the ijs driver for gray devices, one is changing "sizeof(rgb)" in *both* "gs_malloc(ijsdev->memory, sizeof(rgb), 1,..." and "ijsdev->ColorSpace_size = sizeof(rgb);" to a larger number (+2 would do), the other is to preallocate the rgb string to a bigger storage.i.e. from "static const char rgb[] = "DeviceRGB";" "static const char rgb[11] = "DeviceRGB";" Either of these approaches avoid the segfault.
Rewording title. I have opted for a larger char array myself: --- src/gdevijs.c~ 2005-04-21 09:45:29.000000000 +0100 +++ src/gdevijs.c 2005-04-21 10:02:30.000000000 +0100 @@ -813,7 +813,8 @@ gsijs_finish_copydevice(gx_device *dev, const gx_device *from_dev) { int code; - static const char rgb[] = "DeviceRGB"; + /* Need to be big enough to hold DeviceCMYK, DeviceGray as well */ + static const char rgb[11] = "DeviceRGB"; gx_device_ijs *ijsdev = (gx_device_ijs *)dev; code = gx_default_finish_copydevice(dev, from_dev);
Created attachment 1329 [details] patch to set a large char array. patch to set a large array as described to contain DeviceGray/CMYK, plus comment explaining so.
Hin-Tak Leung, Thank you for your efforts with this problem. However I think that your patch is hiding the real problem which is with the str parameter in the call to gs_free at line 983. More information on my version of the fix at: http://ghostscript.com/pipermail/gs-code-review/2005-April/004783.html
Note: For anyone that wants to reproduce this problem on Windows, Russell Lang was nice enough to provide a command line: bin/gswin32c.exe -sDEVICE=ijs -sIjsServer=ijs\ijs_server_example.exe - dProcessColorModel=/DeviceGray -dBATCH -dNOPAUSE -sOutputFile=out.ps examples/colorcir.ps
Created attachment 1331 [details] trimmed version of Dan's diff to address the segfault Had a good look at Dan's diff, and saw most of it was white-space change and adding line-breaks; isolated the important pointer fix. Already patched my ghostscript again and verified that this patch works.
The fix is described in: http://ghostscript.com/pipermail/gs-cvs/2005-April/005490.html Note: This does include the removal of the extra ^M at the end of lines. These were placed there by a previous patch from Alex.
*** Bug 688135 has been marked as a duplicate of this bug. ***