Fop
  1. Fop
  2. FOP-1641

[PATCH] ArrayIndexOutOfBoundsException when applying a CMYK color in PDFGraphics2D

    Details

    • Type: Bug Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: trunk
    • Fix Version/s: None
    • Component/s: renderer/pdf
    • Labels:
    • Environment:
      Operating System: Windows XP
      Platform: PC
    • External issue ID:
      46882

      Description

      There are two bugs in PDFGraphics2D.applyColor.

      Firstly, when applying a color with CMYK colorspace the number of components is 4, not 3.
      See line 744:
      float[] cComps = c.getColorComponents(new float[3]); //results in ArrayIndexOutOfBoundsException

      Secondly, Color.getColorComponents returns values in the range [0, 1] while PDFColor expects them in the [0, 255] range.

      I attached the patch and a sample program to reproduce the trouble.

      Regards,
      Yegor kozlov

      1. cmyk_colorspace.patch
        1 kB
        Yegor Kozlov
      2. FOPScratchpad.java
        0.6 kB
        Yegor Kozlov

        Activity

        Hide
        Yegor Kozlov added a comment -

        Attachment cmyk_colorspace.patch has been added with description: the patch

        Show
        Yegor Kozlov added a comment - Attachment cmyk_colorspace.patch has been added with description: the patch
        Hide
        Yegor Kozlov added a comment -

        Attachment FOPScratchpad.java has been added with description: sample program to reproduce the trouble

        Show
        Yegor Kozlov added a comment - Attachment FOPScratchpad.java has been added with description: sample program to reproduce the trouble
        Hide
        Jeremias Maerki added a comment -

        Thanks for noticing that bug. I've just fixed it but not using your patch as it contained a bug (*256 is not correct) and it was possible to this in a much simpler way.

        http://svn.apache.org/viewvc?rev=757338&view=rev

        Show
        Jeremias Maerki added a comment - Thanks for noticing that bug. I've just fixed it but not using your patch as it contained a bug (*256 is not correct) and it was possible to this in a much simpler way. http://svn.apache.org/viewvc?rev=757338&view=rev
        Hide
        Glenn Adams added a comment -

        batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed

        Show
        Glenn Adams added a comment - batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed

          People

          • Assignee:
            fop-dev
            Reporter:
            Yegor Kozlov
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development