Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
P4
-
Resolution: Fixed
-
Affects Version/s: 17
-
Fix Version/s: 17
-
Component/s: client-libs
-
Labels:
-
Subcomponent:
-
Resolved In Build:b22
-
CPU:generic
-
OS:generic
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8274984 | 11.0.14-oracle | Dmitry Markov | P4 | Resolved | Fixed | b01 |
JDK-8273226 | 11.0.14 | Matthias Baesken | P4 | Resolved | Fixed | b01 |
Description
In java/awt/font/TextJustifier.java justify there is a potential code path where divison by zero might happen , see also the Sonar finding :
https://sonarcloud.io/project/issues?id=shipilev_jdk&open=AXcqMwpm8sPJZZzONu1k&resolved=false&severities=CRITICAL&types=BUG
boolean hitLimit = (weight == 0) || (!lastPass && ((delta < 0) == (delta < gslimit)));
boolean absorbing = hitLimit && absorbweight > 0;
// predivide delta by weight
float weightedDelta = delta / weight; // not used if weight == 0
In case of (weight == 0) the division should not be done because the value of weightedDelta is unused in this case anyway.
https://sonarcloud.io/project/issues?id=shipilev_jdk&open=AXcqMwpm8sPJZZzONu1k&resolved=false&severities=CRITICAL&types=BUG
boolean hitLimit = (weight == 0) || (!lastPass && ((delta < 0) == (delta < gslimit)));
boolean absorbing = hitLimit && absorbweight > 0;
// predivide delta by weight
float weightedDelta = delta / weight; // not used if weight == 0
In case of (weight == 0) the division should not be done because the value of weightedDelta is unused in this case anyway.
Attachments
Issue Links
- backported by
-
JDK-8273226 Avoid division by 0 in java/awt/font/TextJustifier.java justify
-
- Resolved
-
-
JDK-8274984 Avoid division by 0 in java/awt/font/TextJustifier.java justify
-
- Resolved
-
- links to
-
Commit openjdk/jdk11u-dev/d41b37ff
-
Commit openjdk/jdk/ea30bd66
-
Review openjdk/jdk11u-dev/303
-
Review openjdk/jdk/2912
(1 links to)