Bug 695439 - Reference to free memory, or segfault with release build
Summary: Reference to free memory, or segfault with release build
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: master
Hardware: PC Windows 7
: P4 normal
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-22 15:51 UTC by Ray Johnston
Modified: 2014-08-27 07:43 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ray Johnston 2014-08-22 15:51:01 UTC
The following was tripped over while working on Bug 695420.

debugbin/gswin32c -Z@$? -q -sDEVICE=pdfwrite -o x.pdf -dLastPage=1                -c "<< /ProcessColorModel /DeviceGray >> setpagedevice" -f examples/annots.pdf

dies with:

Error: /rangecheck in .installpagedevice
            <--- SNIP --->
GPL Ghostscript GIT PRERELEASE 9.15: Unrecoverable error, exit code 1
GPL Ghostscript GIT PRERELEASE 9.15: .\psi\ilocate.c(597): Reference to free object 0x2190a10(168), in chunk 0x2189b08!
while validating chunk 0x218a2e8 (0x21c9fa0..0x21d0e90, 0x21d0e90..0x21d0e90..0x21d0e90)
GPL Ghostscript GIT PRERELEASE 9.15: .\psi\ilocate.c(258): while validating memory 0x226f980, space 8, level -1
Comment 1 Ken Sharp 2014-08-26 04:08:27 UTC
I'd have to guess this is a similar problem to the last one (Bug #695420), something is awry in the page device dictionary or some similar saved resoruce, after it has been altered by pdfwrite in some way.

You can drop the -q and -Z@$? parameters. The error seems to occur during end of job restore.

FWIW I never get the reference to freed memory, even with the memory checking enabled, just a rangecheck error.
Comment 2 Ken Sharp 2014-08-27 06:47:55 UTC
commit 55bd0a59caf26a59f852e2dec5b76ad399d9408b fixes the rangecheck error and also the memory warning for me. Ray I'd be grateful if you would check that it solves the memory problem for you as well, I'm not completely convinced that it should have.

That commit also addresses the problem of OutputICCProfile not being sent to the device for me.

Details of the problem and the fix can be found in the commit log
Comment 3 Ray Johnston 2014-08-27 07:43:39 UTC
I confirmed that th patch makes both the rangecheck AND the ilocate problem
go away for me, and no segfault with the release build.