Bug 692330

Summary: Seg. fault with regression file
Product: GhostPCL Reporter: Marcos H. Woehrmann <marcos.woehrmann>
Component: PCL interpreterAssignee: Robin Watts <robin.watts>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P4    
Version: master   
Hardware: PC   
OS: All   
Customer: Word Size: ---

Description Marcos H. Woehrmann 2011-07-07 17:23:40 UTC
The following command line generates a seg fault:

./main/obj/pcl6 -o /dev/null -sDEVICE=ppmraw -r600 ./pcl5ccet/21-10.BIN

Replacing the -r600 with -r300 or ppmraw with pgmraw make the seg fault go away.
Comment 1 Marcos H. Woehrmann 2011-07-07 17:27:36 UTC
I've duplicated this on my iMac and on an amd64 Linux box.
Comment 2 Marcos H. Woehrmann 2011-07-07 17:48:08 UTC
This is a regression, the first rev that showed the problem is 449e9c8909e5e0cbf92497f1d95bfe60e8e89f6e
Comment 3 Robin Watts 2011-07-07 20:55:46 UTC
Fixed in:

Author: Robin Watts <robin@ghostscript.com>
Date:   Thu Jul 7 20:50:35 2011 +0000

    Fix bug 692330: SEGV in clist memfile fseek.

    The icc unserialise profile code ftells, then reads, then fseeks to
    maintain the position of the stream. The fseek was leaving the stream
    in an illegal state (the pointer was exactly at the end of the last
    block at the end of the file). Internally we are supposed to always
    have memory allocated for us to write into, and in this circumstance
    we didn't.

    The fseek code was actually correct, as was the ftell code. The problem
    lay in the fwrite code that left the stream in an illegal state.

    The fix is simply to change the fwrite logic slightly; we are guaranteed
    to have space on entry to the loop, so we just need to ensure we have
    space on exit.

    Cluster testing shows no differences (or none due to this change at least).