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

Inconsistent code in the LCMS.c#_writeCookedTag

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • tbd
    • 8, 11, 16, 17
    • client-libs
    • None
    • 2d

       I trying to catch the reason of CMMException which are randomly thrown here and there.

      The ColorConvertOp may fail to use the icc profile if profile tags data was updated.

      The steps to reproduce:
      1. Create the profile and update one of its tag
      2. Try to use the profile by the ColorConvertOp
      3. The CMMException will occur
      4. It is interesting that if we will reread the data from the profile and create a new profile for that data, the ColorConvertOp will work fine

      The root cause is in the LCMS.c#_writeCookedTag method:

      1. We create a temporary profile:
          https://github.com/openjdk/jdk/blob/9bc023220fbbb0b6ea1ed1a0ca2aa3848764e8cd/src/java.desktop/share/native/liblcms/LCMS.c#L741
      2. We update all tags in that profile.
      3. We save and read back that profile:
          https://github.com/openjdk/jdk/blob/9bc023220fbbb0b6ea1ed1a0ca2aa3848764e8cd/src/java.desktop/share/native/liblcms/LCMS.c#L813
      4. We check that the profile from step 3 contains the new data for the tag
          https://github.com/openjdk/jdk/blob/9bc023220fbbb0b6ea1ed1a0ca2aa3848764e8cd/src/java.desktop/share/native/liblcms/LCMS.c#L826
      5. And then we return the temporary profile, instead of validated one
          https://github.com/openjdk/jdk/blob/9bc023220fbbb0b6ea1ed1a0ca2aa3848764e8cd/src/java.desktop/share/native/liblcms/LCMS.c#L837

      And this is the reason why the new profile created on top of the "old" data works fine, since that include the cmsSaveProfileToMem/cmsOpenProfileFromMem steps.

            serb Sergey Bylokhov
            serb Sergey Bylokhov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: