Bug 691447

Summary: Monochrome TIFF devices crash
Product: Ghostscript Reporter: Josh Townzen <josh.townzen>
Component: GeneralAssignee: Default assignee <ghostpdl-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P4    
Version: 8.71   
Hardware: PC   
OS: Windows 98   
Customer: Word Size: ---

Description Josh Townzen 2010-07-08 18:14:53 UTC
When using a monochrome TIFF device, Ghostscript crashes on exit under certain conditions with "GSWIN32C caused an invalid page fault in module GSDLL32.DLL at 019f:1015d0a9".

The easiest way to reproduce this is to call Ghostscript with just the arguments "-dBATCH -sDEVICE=tiffg4", and it will crash immediately.  When I discovered this bug, I noticed that it wasn't happening when I used the "pswrite" or "pdfwrite" devices, so I tested the following devices to see which ones had the problem:

    Device     Crash
    ----------------
    tiffg3     yes
    tiffg4     yes
    tiffpack   yes
    tiffcrle   yes
    tiffg32d   yes
    tifflzw    yes
    tiffgray   no
    tiff12nc   no
    tiff24nc   no
    tiff32nc   no
    tiffsep    no
    pdfwrite   no
    pswrite    no
    pngmono    no

All of the monochrome TIFF devices cause the crash.  None of the grayscale/color TIFF devices do, nor do pswrite or pdfwrite.  I tested pngmono to confirm that the problem wasn't with monochrome output in general.

I've found that it won't always crash, though.  If Ghostscript successfully creates a TIFF output file, then it closes cleanly when it's finished.  For example, the command line "-dBATCH -sDEVICE=tiffg4 -sOutputFile=test.tif test.ps" won't crash, as long as "test.ps" is a valid PS file and that reading it doesn't generate any errors in Ghostscript.

I'm using GPL Ghostscript 8.71 (2010-02-10), and I've reproduced this on Windows 98 and Windows XP machines.  I wasn't able to reproduce the bug on any earlier versions of Ghostscript, including 8.70, 8.64, and 8.61.
Comment 1 Marcos H. Woehrmann 2010-07-19 05:18:26 UTC
Thanks for the detailed analysis and complete bug report.  This issue was found and fixed some time ago:

r10924 | larsu | 2010-03-15 00:44:38 -0700 (Mon, 15 Mar 2010) | 5 lines

Applied Tim Waugh's patch from bug #691171: A NULL check for the argument of
TIFFCleanup was missing, which caused a segfault when opening the output device
failed for any of the devices in gdevtfax.c.


The next release of Ghostscript, currently scheduled for August 2010, will include the fix.

*** This bug has been marked as a duplicate of bug 691171 ***