Bug 693557 - Regression: seg faults staring with 1bc2a56f913ff1fa3f7af06000a4c6dd5c948afd
Summary: Regression: seg faults staring with 1bc2a56f913ff1fa3f7af06000a4c6dd5c948afd
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Regression (show other bugs)
Version: master
Hardware: PC All
: P2 blocker
Assignee: Ray Johnston
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-14 08:20 UTC by Marcos H. Woehrmann
Modified: 2013-01-17 14:04 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos H. Woehrmann 2013-01-14 08:20:11 UTC
The fix for Bug 693361, 1bc2a56f913ff1fa3f7af06000a4c6dd5c948afd, introduced seg faults with psdcmyk output for several files.

Here is an example command line:

  bin/gs -dMaxBitmap=10000 -sDEVICE=psdcmyk -dNumRenderingThreads=4 -r300 ./Bug689422.pdf


This is the list of the affected files:

tests__pdf__Bug6901014_CityMap-evince-pdftopdf.pdf.psdcmyk.300.1
tests__pdf__Bug6901014_CityMap-evince.pdf.psdcmyk.300.1
tests__pdf__Bug6901014_CityMap-evince.simplified.pdf.psdcmyk.300.1
tests__pdf__Transparency-DesignGuide.pdf.psdcmyk.300.1
tests_private__comparefiles__148-11.ps.psdcmyk.300.1
tests_private__comparefiles__477-04.ps.psdcmyk.300.1
tests_private__comparefiles__Bug689422.pdf.psdcmyk.300.1
tests_private__comparefiles__Bug689690.pdf.psdcmyk.300.1
tests_private__comparefiles__Bug689918.pdf.psdcmyk.72.0
tests_private__comparefiles__Bug689982.pdf.psdcmyk.72.0
tests_private__comparefiles__Bug690189a.pdf.psdcmyk.300.1
tests_private__comparefiles__Bug690208.pdf.psdcmyk.300.1
tests_private__comparefiles__Bug690398.pdf.psdcmyk.300.1
tests_private__comparefiles__Bug690748.pdf.psdcmyk.300.1
tests_private__comparefiles__Bug690831.pdf.psdcmyk.300.1
tests_private__comparefiles__Bug690831.pdf.psdcmyk.72.0
tests_private__comparefiles__Bug690835.pdf.psdcmyk.72.0
tests_private__comparefiles__Bug691763.pdf.psdcmyk.300.1
tests_private__comparefiles__Bug692368.pdf.psdcmyk.300.1
tests_private__comparefiles__type1-ce1_setcurrentpoint.ps.psdcmyk.300.1
tests_private__pdf__PDFIA1.7_SUBSET__CATX5233.pdf.psdcmyk.300.1
tests_private__pdf__sumatra__1157_-_grey_bars_under_titles_regression_from_r2574.pdf.psdcmyk.300.1
tests_private__pdf__sumatra__1439_-_color_softmask_fails_to_draw_jpx_image.pdf.psdcmyk.300.1
tests_private__pdf__sumatra__435_-_misrendering.pdf.psdcmyk.300.1
tests_private__pdf__sumatra__51_-_knockout_and_isolated_groups_not_supported.pdf.psdcmyk.300.1
tests_private__pdf__sumatra__743_-_missing_gradient_in_included_figure.pdf.psdcmyk.300.1
tests_private__pdf__sumatra__x_-_renders_slowly.pdf.psdcmyk.300.1
Comment 1 Marcos H. Woehrmann 2013-01-14 08:21:07 UTC
Here's output from gdb:

(gdb) run -dBATCH -dNOPAUSE -sOutputFile=test.psd -dMaxBitmap=10000 -sDEVICE=psdcmyk -dNumRenderingThreads=4 -r300 -sDEFAULTPAPERSIZE=letter /home/marcos/cluster/tests_private/comparefiles/Bug689422.pdf
Starting program: /home/marcos/artifex/ghostpdl/gs/debugbin/gs -dBATCH -dNOPAUSE -sOutputFile=test.psd -dMaxBitmap=10000 -sDEVICE=psdcmyk -dNumRenderingThreads=4 -r300 -sDEFAULTPAPERSIZE=letter /home/marcos/cluster/tests_private/comparefiles/Bug689422.pdf
[Thread debugging using libthread_db enabled]
GPL Ghostscript GIT PRERELEASE 9.07 (2012-07-31)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
[New Thread 0x7ffff208d700 (LWP 13287)]
[Thread 0x7ffff208d700 (LWP 13287) exited]
Processing pages 1 through 1.
Page 1
[New Thread 0x7ffff208d700 (LWP 13288)]
[Thread 0x7ffff208d700 (LWP 13288) exited]
[New Thread 0x7ffff208d700 (LWP 13289)]
[Thread 0x7ffff208d700 (LWP 13289) exited]
[New Thread 0x7ffff208d700 (LWP 13290)]
[Thread 0x7ffff208d700 (LWP 13290) exited]
[New Thread 0x7ffff208d700 (LWP 13291)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff208d700 (LWP 13291)]
0x000000000052fce3 in gx_pattern_size_estimate (pinst=0x1931d5ae, has_tags=0) at ./base/gxpcmap.c:219
219	    gx_device *tdev = pinst->saved->device;
(gdb) where
#0  0x000000000052fce3 in gx_pattern_size_estimate (pinst=0x1931d5ae, has_tags=0) at ./base/gxpcmap.c:219
#1  0x0000000000532c8a in gx_pattern_load (pdc=0x7ffff208a4d0, pis=0x7ffff2087310, dev=0x1b3e008, select=gs_color_select_texture) at ./base/gxpcmap.c:1310
#2  0x0000000000527988 in gx_dc_pattern_load (pdevc=0x7ffff208a4d0, pis=0x7ffff2087310, dev=0x1b3e008, select=gs_color_select_texture) at ./base/gsptype1.c:1259
#3  0x00000000006e5875 in clist_playback_band (playback_action=playback_action_render, cdev=0x1b340a8, s=0x7ffff208bf30, target=0x1b3e008, x0=0, y0=0, mem=0x1b8d590) at ./base/gxclrast.c:1789
#4  0x00000000006ee213 in clist_playback_file_bands (action=playback_action_render, crdev=0x1b340a8, page_info=0x7ffff208c7c8, target=0x1b381e8, band_first=0, band_last=0, x0=0, y0=0) at ./base/gxclread.c:856
#5  0x00000000006eddbc in clist_render_rectangle (cldev=0x1b340a8, prect=0x7ffff208cdb0, bdev=0x1b381e8, render_plane=0x0, clear=1) at ./base/gxclread.c:784
#6  0x000000000070dc59 in clist_render_thread (data=0x18e5800) at ./base/gxclthrd.c:407
#7  0x00000000007147dd in gp_thread_begin_wrapper (thread_data=0x1bb0a10) at ./base/gp_psync.c:223
#8  0x00007ffff64a39ca in start_thread (arg=<value optimized out>) at pthread_create.c:300
#9  0x00007ffff54d421d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#10 0x0000000000000000 in ?? ()
(gdb)
Comment 2 Ray Johnston 2013-01-17 14:04:34 UTC
This was due to the pdf14 device changing num_components during clist playback
when it had not changed during writing the clist. When a pattern tried to load
it failed the check that the depth of the pattern matched the depth of the
device. This was traced to picking the pdf14cmyk device during rendering instead
of the pdf14CMYKspot device because the thread's max_components was set to 4,
not 14 (as during clist writing). Fix the MaxSeparations in gsdparam to return
max_components instead of num_components, then fix devn_get_params to pass the
PageSpotColors param and the setting of num_components in devn_put_params to
ignore max_separations since that doesn't make sense.

BTW, the reason that the 1bc2a56 patch caused the regression is that the
ndev had its color_info set by the put_device_params and the max_separations
was set to 4. When the original 'cdev->target' was used as the target device,
the color_info.max_components was at 14, the value set by the parser, so
that the pdf14 logic picked the correct prototype instance (pdf14CMYKspot).

The above was committed in commit 37e07e95a5588c2feaba60bbf506a7a9e433a43c

Testing of some of the problem files that previously failed worked. We will
see with the next NumRenderingThreads regression run.