Summary: | segmentation fault while processing masked images | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Agis Andreou <agis> |
Component: | PDF Interpreter | Assignee: | Alex Cherepanov <alex> |
Status: | RESOLVED FIXED | ||
Severity: | minor | ||
Priority: | P5 | ||
Version: | 8.63 | ||
Hardware: | PC | ||
OS: | Linux | ||
URL: | http://dev.innews.gr/pdf_tiff/forps/ghostscript/ | ||
Customer: | Word Size: | --- | |
Attachments: |
multipdf2_mp.pdf
multipdf2_mp_simplified.pdf testcase.tar.gz patch |
Description
Agis Andreou
2009-02-26 07:33:58 UTC
I'm not able to find any problems with the files in the notworking.tar archive, but I can reproduce a problem with the file multipdf2_mp.pdf: marcos@macbookpro:[39]% gshead -sDEVICE=tiff24nc -o test%d.tif ./multipdf2_mp.pdf GPL Ghostscript SVN PRE-RELEASE 8.65 (2009-02-04) Copyright (C) 2009 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Processing pages 1 through 44. Page 1 Loading NimbusSanL-Regu font from %rom%Resource/Font/NimbusSanL-Regu... 2930964 1098159 11710988 10303474 3 done. Page 2 ../gshead: line 1: 52847 Segmentation fault ~/artifex/ghostscript/gs/bin/gs - I/Users/marcos/artifex/ghostscript/gs/lib -I/Users/marcos/artifex/fonts -dNOPAUSE -dBATCH $* marcos@macbookpro:[40]% Created attachment 4814 [details]
multipdf2_mp.pdf
Created attachment 4815 [details]
multipdf2_mp_simplified.pdf
Simplified version of the original file (attempts to remove any remaining
elements using Acrobat 9.0 results in file that is readable by Ghostscript).
we confirm that files in notworking.tar do not fail on a clean system root@thbux:~/agis# ghostscript -sDEVICE=pswrite -sOutputFile=a.ps -sNOPAUSE -sBATCH notworking.pdf GPL Ghostscript 8.63 (2008-08-01) Copyright (C) 2008 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Processing pages 1 through 1. Page 1 However they do fail on our initial system: root@dev:~/agis/pdfcreator/forps/ghostscript# ghostscript -sNOPAUSE -sBATCH notworking.pdf GPL Ghostscript 8.63 (2008-08-01) Copyright (C) 2008 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Processing pages 1 through 1. Page 1 Segmentation fault What could differ from one system to an other? root@thbux:~/agis# cat /proc/version Linux version 2.6.26-5-generic (buildd@crested) (gcc version 4.3.1 (Ubuntu 4.3.1-9ubuntu1) ) #1 SMP Fri Aug 15 13:54:22 UTC 2008 root@thbux:~/agis# cat /proc/cpuinfo | grep "model name" model name : AMD Athlon(tm) 64 X2 Dual Core Processor 4400+ model name : AMD Athlon(tm) 64 X2 Dual Core Processor 4400+ root@dev:~/agis/pdfcreator/forps/ghostscript# cat /proc/version Linux version 2.6.17-12-generic (root@king) (gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)) #2 SMP Tue Feb 12 00:40:49 UTC 2008 (Ubuntu 2.6.17-12.44-generic) root@dev:~/agis/pdfcreator/forps/ghostscript# cat /proc/cpuinfo | grep "model name" model name : AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ model name : AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ reinstalling ghostscript corrected the problem with notworking.pdf in both systems. But our main concern is multipdf2_mp.pdf. I rushed to confirm notworking was OK. Using -sDEVICE=ps2write instead of -sDEVICE=pswrite as we were using during debugging we get the segmentation fault on both linux systems and a windows workstation. Nevertheless files like multipdf2_mp.pdf are our primary concern and multipdf2_mp_simplified.pdf fails in our systems too. Using any program to preprocess the pdf would be great for our purpose. Our current solution is to replace the masked images with non-masked DCTencoded ones which work without problems but result in *10 file size. root@dev:~/agis/pdfcreator/forps/ghostscript# ghostscript -sDEVICE=ps2write -sOutputFile=a.ps -sNOPAUSE -sBATCH notworking.pdf GPL Ghostscript 8.63 (2008-08-01) Copyright (C) 2008 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Processing pages 1 through 1. Page 1 Segmentation fault root@dev:~/agis/pdfcreator/forps/ghostscript# root@thbux:~/agis# ghostscript -sDEVICE=ps2write -sOutputFile=a.ps -sNOPAUSE -sBATCH notworking.pdf GPL Ghostscript 8.63 (2008-08-01) Copyright (C) 2008 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Processing pages 1 through 1. Page 1 Segmentation fault root@thbux:~/agis# C:\Documents and Settings\agis\Desktop\notworking>"c:\Program Files\gs\gs8.63\b n\gswin32c.exe" -sDEVICE=ps2write -sOutputFile=test.ps notworking.pdf GPL Ghostscript 8.63 (2008-08-01) Copyright (C) 2008 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Processing pages 1 through 1. Page 1 ["this program has encountered an error an needs to close" dialog] Created attachment 4817 [details]
testcase.tar.gz
a further simplified version of multipdf2_mp_simplified.pdf that fails
(out.pdf_simplified2.pdf) along with one with the same content (different
compression/dict-entries) that succeeds (out.pdf_simplified.pdf).
Thank you for your time (and patience if you read my lengthy comments...). It seems that the problem in multipdf2_mp.pdf (and testcase.tar.gz) is in the JBIG2Encode software we used (http://www.imperialviolet.org/jbig2.html) and somehow Acrobat bypasses it. Files also fail when moving them directly in a Xerox/Sun printer hot folder. It is strange though that the same images with the same encoding work if pdf is splitted to one page per file. Knowing the exact encoding error and splitting corrects the problem would be interesting but in any case we solved our problem by decoding the mask using jbig2dec and then flate encoding it. It would also be interesting to know why decompressed files in notworking.tar.gz fail when -sDEVICE ps2write is used instead of -sDEVICE pswrite or tiff24nc. Finally it is probably an error in usage but it would be interesting to know why when using ghostscript on a linux system through ssh and without an -sDEVICE parameter "notworking[decompressed].pdf" fails while simply changing the page size to A4 seems to fix the problem. (it is kind of embarassing now that I notice, but this was the difference between the two systems: I was using a different command line, on dev I did not include an -sDEVICE option, thought that the output method was irrelevant) Hope you have time to give to these issues ... It is not a blocker for us any more so I lowered Severity/Priority. thank you again Created attachment 4820 [details]
patch
When /JBIG2Decode filter takes /.jbig2globalctx parameter and retains a pointer
to it, the filter must not be allocated in global memory if the parameter
is local.
The patch is committed as a rev. 9514. Regression testing shows no differences. |