-
Bug
-
Resolution: Fixed
-
P4
-
8, 11, 17, 20, 21
-
b26
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8310312 | 17.0.9 | Frederic Thevenet | P4 | Resolved | Fixed | b01 |
The method formatDataAmount(String formatter, long amount) in jdk.jfr.internal.Utils throws a StringIndexOutOfBoundsException when amount is equal to Long.MIN_VALUE.
A comment in the method itself warns that Long.MIN_VALUE isn't properly handled since its absolute value is negative, but no explicit attempt to reject such value is ever made (e.g. throw IllegalArgumentException): instead this will cause the rest of the code to fail with the exception above.
It is important that Long.MIN_VALUE amounts be handled correctly by this method because it is used by jdk.jfr.internal.tool.PrettyWriter which in turn in called by RecordedEvent.toString and the "jfr print" command, which therefore fail with the above exception when encountering recordings that contain events with a field typed as BYTES and a value of Long.MIN_VALUE.
This is not a theoretical risk either, as for example every instance of jdk.YoungGenerationConfiguration captured when using ShenandoahGC (and I suspect any other non-generational GC) appear to have a maxSize field with a value of Long.MIN_VALUE.
A comment in the method itself warns that Long.MIN_VALUE isn't properly handled since its absolute value is negative, but no explicit attempt to reject such value is ever made (e.g. throw IllegalArgumentException): instead this will cause the rest of the code to fail with the exception above.
It is important that Long.MIN_VALUE amounts be handled correctly by this method because it is used by jdk.jfr.internal.tool.PrettyWriter which in turn in called by RecordedEvent.toString and the "jfr print" command, which therefore fail with the above exception when encountering recordings that contain events with a field typed as BYTES and a value of Long.MIN_VALUE.
This is not a theoretical risk either, as for example every instance of jdk.YoungGenerationConfiguration captured when using ShenandoahGC (and I suspect any other non-generational GC) appear to have a maxSize field with a value of Long.MIN_VALUE.
- backported by
-
JDK-8310312 jdk.jfr.internal.Utils::formatDataAmount method should gracefully handle amounts equal to Long.MIN_VALUE
- Resolved
- relates to
-
JDK-8309959 JFR: Display N/A for missing data amount
- Resolved
- links to
-
Commit openjdk/jdk17u-dev/7697ab46
-
Commit openjdk/jdk/a1ab377d
-
Review openjdk/jdk11u-dev/1942
-
Review openjdk/jdk17u-dev/1423
-
Review openjdk/jdk/14341
(2 links to)