Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8282577

ICC_Profile.setData(int, byte[]) invalidates the profile

    XMLWordPrintable

Details

    • 2d
    • b14

    Backports

      Description


        Upgrading OpenJDK to use LittleCMS 2.13.1 I found that the commit
        https://github.com/mm2/Little-CMS/commit/ab5029d60d5dc41a414e4acc472d024e3449d36a
        was causing one of our "stress" tests to have a native crash inside LittleCMS.
        The stress test creates lots of threads updating profiles (internally using cmsReadRawTag/cmswriteRawTag) and then using them so it looked like a threading problem.
        I found it to be nothing to do with stress testing nor threading and to be a combination of a JDK mis-use of the LittleCMS APIs exposing a LittleCMS bug which actually causes the crash.

        The LittleCMS upstream bug will be dealt with separately but the OpenJDK bug needs to be fixed for this API to work properly regardless of the status of the LittleCMS bug.

        ICC_Profile provides an API to update the content of a tag for a profile.
        For this the implementation use cmsReadRawTag/cmsWriteRawTag to copiy a profile completely and instantiate a new one.
        But this profile is never opened - and the use of the "Raw" APIs means it needs to be per the docs at
        https://www.littlecms.com/LittleCMS2.13%20API.pdf which state on p67
        Accessing tags as raw data
        Those functions allows to read/write directly to the ICC profile any data, without checking anything.
        As a rule, mixing Raw with cooked doesn't work, so writing a tag as raw and then reading it as cooked
        without serializing does result into an error. If that is what you want, you will need to dump the profile to
        memory or disk and then reopen it.

        Attachments

          Issue Links

            Activity

              People

                prr Philip Race
                prr Philip Race
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: