Bug 693248 - DeviceN remap structure should be dynamically allocated
Summary: DeviceN remap structure should be dynamically allocated
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Color (show other bugs)
Version: master
Hardware: PC Windows 7
: P4 normal
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-02 23:15 UTC by Michael Vrhel
Modified: 2023-05-31 16:01 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 Michael Vrhel 2012-08-02 23:15:43 UTC
Right now the structure int_remap_color_info_s has a fixed size for the number of colorants that can be handled.  This number is specified by MAX_COMPONENTS_IN_DEVN.   If a document has more than this number of colorants in a DeviceN color space we will have all sort of ugly things occur since the interpreter has no knowledge of the size limit of this structure.  Either the interpreter needs to know the size or better yet, the structure should be dynamically allocated to the number ov colorants needed.
Comment 1 Michael Vrhel 2012-08-02 23:16:18 UTC
Assigning to Ray who wanted to take care of this one
Comment 2 Ray Johnston 2012-08-02 23:49:48 UTC
I investigated and psi/zcolor.c has a check:

       if (r_size(&namesarray) > GS_CLIENT_COLOR_MAX_COMPONENTS)
        return_error(e_limitcheck);

If we change this to MAX_COMPONENTS_IN_DEVN then any overflow in icremap.c
due to access outside the array bounds, however, I still think that we should
have MAX_COMPONENTS_IN_DEVN set to GS_CLIENT_COLOR_MAX_COMPONENTS. Why it
should ever be less is not clear to me.
Comment 3 Michael Vrhel 2012-08-03 03:08:18 UTC
I think MAX_COMPONENTS_IN_DEVN should be replaced with a dynamic allocation but I dont have a problem with going to GS_CLIENT_COLOR_MAX_COMPONENTS if it doesn't effect performance
Comment 4 Ken Sharp 2023-05-31 16:01:55 UTC
'Fixed' in commit 7a8e8f962f45f6f05c34e8ac2626f9caa8fe8460

Replaces MAX_COMPONENTS_IN_DEVN with GS_CLIENT_COLOR_MAX_COMPONENTS.