RFR: 8303669: SelectVersion indexes past the end of the argv array

Adam Sotona asotona at openjdk.org
Wed May 3 12:10:08 UTC 2023


libjli/java.c's SelectVersion method receives argc and argv but ignores argc in some circumstances an instead checks if *argv == 0 in its while loop, which results in a segmentation fault if the provided array is not NULL terminated. 

This patch counts down argc in the while loops instead of looking for zero termination.

Please review.

Thank you,
Adam

-------------

Commit messages:
 - 8303669: SelectVersion indexes past the end of the argv array

Changes: https://git.openjdk.org/jdk/pull/13775/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13775&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8303669
  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/13775.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13775/head:pull/13775

PR: https://git.openjdk.org/jdk/pull/13775


More information about the core-libs-dev mailing list