NegativeArraySizeException in radial shading

Details

Description

I get this exception with the attached file:

java.lang.NegativeArraySizeException
at org.apache.pdfbox.pdmodel.graphics.shading.RadialShadingContext.calcColorTable(RadialShadingContext.java:186)
at org.apache.pdfbox.pdmodel.graphics.shading.RadialShadingContext.<init>(RadialShadingContext.java:149)
at org.apache.pdfbox.pdmodel.graphics.shading.RadialShadingPaint.createContext(RadialShadingPaint.java:68)
at sun.java2d.pipe.AlphaPaintPipe.startSequence(AlphaPaintPipe.java:83) at sun.java2d.pipe.AlphaPaintPipe.startSequence(AlphaPaintPipe.java:83)
at sun.java2d.pipe.AAShapePipe.renderTiles(AAShapePipe.java:168)
at sun.java2d.pipe.AAShapePipe.renderPath(AAShapePipe.java:159)
at sun.java2d.pipe.AAShapePipe.fill(AAShapePipe.java:68)
at sun.java2d.pipe.PixelToParallelogramConverter.fill(PixelToParallelogramConverter.java:164)
at sun.java2d.pipe.ValidatePipe.fill(ValidatePipe.java:160)
at sun.java2d.SunGraphics2D.fill(SunGraphics2D.java:2466)
at org.apache.pdfbox.rendering.PageDrawer.shadingFill(PageDrawer.java:984)
at org.apache.pdfbox.util.operator.graphics.ShadingFill.process(ShadingFill.java:36)

The cause is a negative radius due to a negative scale in the CTM (see also PDFBOX-2217).