Bug 46882 - [PATCH] ArrayIndexOutOfBoundsException when applying a CMYK color in PDFGraphics2D
Summary: [PATCH] ArrayIndexOutOfBoundsException when applying a CMYK color in PDFGraph...
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: pdf (show other bugs)
Version: trunk
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2009-03-20 01:44 UTC by Yegor Kozlov
Modified: 2012-04-01 06:49 UTC (History)
0 users



Attachments
the patch (1.06 KB, patch)
2009-03-20 01:45 UTC, Yegor Kozlov
Details | Diff
sample program to reproduce the trouble (656 bytes, text/x-java-source)
2009-03-20 01:45 UTC, Yegor Kozlov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yegor Kozlov 2009-03-20 01:44:41 UTC
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
Comment 1 Yegor Kozlov 2009-03-20 01:45:18 UTC
Created attachment 23394 [details]
the patch
Comment 2 Yegor Kozlov 2009-03-20 01:45:48 UTC
Created attachment 23395 [details]
sample program to reproduce the trouble
Comment 3 Jeremias Maerki 2009-03-23 00:49:10 UTC
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
Comment 4 Glenn Adams 2012-04-01 06:49:10 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed