Bug 691429 - icc memory problem
Summary: icc memory problem
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Color (show other bugs)
Version: master
Hardware: PC All
: P4 normal
Assignee: Michael Vrhel
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-28 19:38 UTC by Henry Stiles
Modified: 2010-07-01 22:01 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 Henry Stiles 2010-06-28 19:38:57 UTC
After a memory failure the new icc code (see gs_malloc(lcms) below), for some reason, allocates more memory which also fails, then tries to use the memory resulting in a bus error:

in gdb:



Starting program: /Users/henrys/ghostpdl_fresh/gs/debugobj/gs -r600 -K6000 -sDEVICE=ppmraw -sOutputFile=foo.ppm ~/tests_private/comparefiles/Altona-Testsuite_p2_S_x3.pdf
GPL Ghostscript SVN PRE-RELEASE 8.72 (2010-02-11)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
[a+]gs_malloc(chunk)(20000) = 0x0: exceeded limit, used=6127256, max=6127256
Unrecoverable error: VMerror in gsave
[a+]gs_malloc(lcms)(557168) = 0x0: exceeded limit, used=6111882, max=6128654

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000008
0x001a1114 in cmsGetColorSpace (hProfile=0x0) at lcms/src/cmsio0.c:567
(gdb) bt
#0  0x001a1114 in cmsGetColorSpace (hProfile=0x0) at lcms/src/cmsio0.c:567
#1  0x001910a2 in gscms_get_input_channel_count ()
#2  0x0018c720 in gsicc_set_profile (icc_manager=0x202f0f4, pname=0x2021858 "default_cmyk.icc", namelen=17, defaulttype=DEFAULT_CMYK) at gsicc_manage.c:595
#3  0x000202b1 in set_default_cmyk_icc (i_ctx_p=0x202f224, pval=0xbffff078) at zusparam.c:742
#4  0x000208f8 in setparams (i_ctx_p=0x202f224, plist=0xbffff0e4, pset=0x109cad0) at zusparam.c:1011
#5  0x00020618 in set_user_params (i_ctx_p=0x202f224, paramdict=0x202f27c) at zusparam.c:904
#6  0x000b034e in context_state_load (i_ctx_p=0x202f224) at icontext.c:255
#7  0x000bda46 in gs_vmreclaim (dmem=0x202f228, global=1) at ireclaim.c:178
#8  0x000bd771 in ireclaim (dmem=0x202f2c8, space=8) at ireclaim.c:75
#9  0x000b64d7 in interp_reclaim (pi_ctx_p=0x1701bfc, space=8) at interp.c:415
#10 0x000ab028 in gs_main_finit (minst=0x1701ba8, exit_status=255, code=-25) at imain.c:779
#11 0x000ab660 in gs_to_exit_with_code (mem=0x1700920, exit_status=255, code=-25) at imain.c:865
#12 0x00002159 in main (argc=6, argv=0xbffff374) at gs.c:138
(gdb)
Comment 1 Michael Vrhel 2010-06-29 02:46:53 UTC
OK.  Looking into this.  I agree, it should have failed at the first allocation failure.
Comment 2 Michael Vrhel 2010-07-01 22:01:45 UTC
So first a chunk allocation fails and this ends up eventually leading to a vmreclaim, which is followed by a context state load, which sets the user params, which trys to load the icc default profiles.  These fail due to there being insufficient memory for the cmm object.   With rev 11480 this error is now bubbled back up for the program to end gracefully.