RFR: 8341495: JShell crashes with java.util.MissingFormatArgumentException [v3]
Archie Cobbs
acobbs at openjdk.org
Fri Oct 4 15:01:55 UTC 2024
> JShell prints some of its output using `printf()` formatted strings. However, there are a few spots where a string `str` to be printed is passed directly as a format string like `format(str)` instead of indirectly like `format("%s", str)`, even though the string `str` contains unknown or arbitrary content outside of JShell's control. As a result, JShell can crash suddenly with a `MissingFormatArgumentException` or similar exception if the string `str` happens to contain a `%` format specifier, etc.
>
> Please review this patch which attempts to fix the places where an unknown string is passed directly as a format string.
Archie Cobbs has updated the pull request incrementally with two additional commits since the last revision:
- Revert previous change to unrelated JLine prompt substitution.
- Use replace() instead of replaceAll() for literal string substitution.
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/21339/files
- new: https://git.openjdk.org/jdk/pull/21339/files/e8116cba..f8a5de5f
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=21339&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=21339&range=01-02
Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/21339.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/21339/head:pull/21339
PR: https://git.openjdk.org/jdk/pull/21339
More information about the kulla-dev
mailing list