Bug 694066 - Unrecoverable error: stackunderflow in .setdistillerparams
Summary: Unrecoverable error: stackunderflow in .setdistillerparams
Status: RESOLVED INVALID
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: master
Hardware: PC Windows 8
: P4 normal
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-10 14:34 UTC by jritmeijer
Modified: 2013-08-24 02:40 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
Test file (85.16 KB, application/pdf)
2013-05-10 14:34 UTC, jritmeijer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jritmeijer 2013-05-10 14:34:38 UTC
Created attachment 9716 [details]
Test file

Just got the latest source (9.08 pre-release) and carried out a 64 bit build.

When I issue the following command:

gswin64c.exe -sDEVICE=pdfwrite -dBATCH -dNOPAUSE -dNOOUTERSAVE -dPDFSETTINGS=/printer  -sOutputFile="out.pdf" "1907.pdf"

it fails as follows:

GPL Ghostscript GIT PRERELEASE 9.08 (2013-01-29)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
GPL Ghostscript GIT PRERELEASE 9.08: Set UseCIEColor for UseDeviceIndependentColor to work properly.
Unrecoverable error: stackunderflow in .setdistillerparams

This worked fine with the official 9.07 release.

I know this is not an official release, but I thought I'd report it.
Comment 1 Ken Sharp 2013-05-10 16:06:47 UTC
Actually, the total error starts with:
"SetUseCIEColor for UseDeviceIndependentColor to work properly"

If you set -dUseCIEColor, the file works. The colour code is partially rewritten but not complete yet.
Comment 2 jritmeijer 2013-05-10 16:13:47 UTC
Thanks.

For PDFA1b output (a slightly different command line, but same result) I believe I need to specify "-dUseCIEColor", so I do not have the option to drop it.

To make it easy to reproduce I minimised the number of switches to the bare minimum for you.

I understand bits are being rewritten, but will I be able to use the "-dUseCIEColor" switch in the final 9.08 release?
Comment 3 Ken Sharp 2013-05-10 16:18:43 UTC
(In reply to comment #2)

> For PDFA1b output (a slightly different command line, but same result) I
> believe I need to specify "-dUseCIEColor", so I do not have the option to
> drop it.

I'm not suggesting you drop it, I'm suggesting you *add* it.

 
> I understand bits are being rewritten, but will I be able to use the
> "-dUseCIEColor" switch in the final 9.08 release?

You should not need to, and I would suggest that you really don't, when the work is complete. The CMS should not need this frankly awful kludge.
Comment 4 jritmeijer 2013-08-23 07:22:31 UTC
Apologies for misreading your original reply and the delay in getting back. I decided to wait until the next official release.

I have just downloaded the final 9.09 (Windows 64 bit version) and am still getting the same problem.


gswin64c.exe -sDEVICE=pdfwrite -dBATCH -dNOPAUSE -dNOOUTERSAVE -dPDFSETTINGS=/printer  -sOutputFile="out.pdf" "1907.pdf"

GPL Ghostscript 9.09 (2013-08-21)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
GPL Ghostscript 9.09: Set UseCIEColor for UseDeviceIndependentColor to work properly.
Unrecoverable error: stackunderflow in .setdistillerparams



When I add "-dUseCIEColor" I get a different error.

GPL Ghostscript 9.09 (2013-08-21)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Unrecoverable error: invalidaccess in gstate
Operand stack:
    false  --nostringval--  savedinitialgstate



When I change "-dPDFSETTINGS=/printer" to "-dPDFSETTINGS=/screen" then it works, but I guess that is because /screen uses a different colour model.


Trying to keep the color space unmodified by using "-dNOSUBSTDEVICECOLORS" results in an error as well.


I have found a number of workarounds, which I am happy to use, just wondering why the original command line switches now cause an error.

1. Add "-dColorConversionStrategy=/LeaveColorUnchanged"
2. Use /prepress rather than /printer


Is this all a bug in 9.09 (it worked fine in 9.07)?
Comment 5 Ken Sharp 2013-08-23 08:02:11 UTC
(In reply to comment #4)
> Apologies for misreading your original reply and the delay in getting back.
> I decided to wait until the next official release.
> 
> I have just downloaded the final 9.09 (Windows 64 bit version) and am still
> getting the same problem.

If you check the ChangeLog you will see that the colour work did not make it into this release. So nothing has changed.

 
> Trying to keep the color space unmodified by using "-dNOSUBSTDEVICECOLORS"
> results in an error as well.

That switch doesn't do that, use -dCOlorConversionStrategy=/LeaveColorUnchanged for pdfwrite.

 
> Is this all a bug in 9.09 (it worked fine in 9.07)?

Possibly, if so its a completely different bug, with a different version of GS, please don't keep reopening this bug.
Comment 6 jritmeijer 2013-08-23 09:04:13 UTC
Apologies, I started reading the changelog, but it is massive so I did a search for UseCIEColor and found nothing relevant.

I will check better next time.

Just a quick note, the example in your PDF/A documentation uses -dUseCIEColor which causes an error. http://ghostscript.com/doc/current/Ps2pdf.htm#PDFA. 

I'll revisit this topic when the colour work has been implemented.
Comment 7 Ken Sharp 2013-08-23 09:10:30 UTC
(In reply to comment #6)
 
> Just a quick note, the example in your PDF/A documentation uses
> -dUseCIEColor which causes an error.
> http://ghostscript.com/doc/current/Ps2pdf.htm#PDFA. 

Yes and I'm looking at that, but its clearly a different problem.
Comment 8 Ken Sharp 2013-08-24 02:40:44 UTC
Commit  2001f469b539a5ccce301ace5d6384b6b7e46888 should fix the problem with -dUseCIEColor. Thanks for pointing this out, surprisingly nobody else had noticed.

Rather than read the ChangeLog (which is the definitive source for changes, but is as you say lengthy) you can read News.htm where any significant changes such as using LCMS2 for pdfwrite will be recorded. When the change is finally completed it probably won't mention UseCIEColor because it won't involve any changes to its behaviour.