Bug 65280 - Upper cap missing while extracting LumMod percentage value in method getPercentageValue of XSLFColor class , returning more than 100% value in case of ppt if lumMod is 120000
Summary: Upper cap missing while extracting LumMod percentage value in method getPerce...
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: XSLF (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-30 10:44 UTC by Nadish
Modified: 2021-05-02 22:15 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nadish 2021-04-30 10:44:51 UTC
I am using poi version poi-ooxml-3.11.jar 
While converting .pptx to images ,i am getting exception as java.lang.IllegalArgumentException: Color parameter outside of expected range: Red Green
at java.awt.Color.testColorValueRange(Color.java:310)

RCA:
In getPercentageValue mehod of XSLFColor class there is no upper bound if percentage is coming more than 100% .
I am converting a pptx file whose color theme is coming with value as 
<xml-fragment pos="0" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"> 
  <a:schemeClr val="phClr">
    <a:tint val="90000"/>
    <a:satMod val="92000"/>
    <a:lumMod val="120000"/>
  </a:schemeClr>
</xml-fragment>

Now lumMod percentage is coming as 120% which exceeds RGB color space of (255,255,255) and exception is coming 

In getPercentageValue method check should be there if percentage is exceeding 100% then it should return 100
Comment 1 PJ Fanning 2021-04-30 10:53:58 UTC
POI 3.11 is no longer supported. Please use POI 5.0.0.
Comment 2 Dominik Stadler 2021-05-01 16:31:20 UTC
Which application produces this file? Any chance of fixing it there?

Please note that in general we are trying not to cater for all the semi-broken files that are produced by all the tools out there, so we should first look at what the spec states and support mostly that and only put in workarounds for broken files if really necessary/useful.
Comment 3 Andreas Beeker 2021-05-02 22:15:46 UTC
I've changed the Color processing a while ago, but long after 3.11.
The RGB colors are now transferred to HSL and back again.
In HSL the mod is applied to the current mod, so 120% or mod * 1.2 should be ok.
This issue should work now - if not, feel free to reopen the ticket.