On Wed, 10 Mar 2021 12:31:31 GMT, Matthias Baesken <mbaes...@openjdk.org> wrote:
> In java/awt/font/TextJustifier.java justify-method 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. This pull request has now been integrated. Changeset: ea30bd66 Author: Matthias Baesken <mbaes...@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/ea30bd6684fa3003889062a129a5aee1bc9b0024 Stats: 6 lines in 1 file changed: 3 ins; 0 del; 3 mod 8263362: Avoid division by 0 in java/awt/font/TextJustifier.java justify Reviewed-by: psadhukhan ------------- PR: https://git.openjdk.java.net/jdk/pull/2912