Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check UTF-8 encoding in JNI functions #5991

Merged
merged 1 commit into from
May 8, 2023
Merged

Check UTF-8 encoding in JNI functions #5991

merged 1 commit into from
May 8, 2023

Conversation

koutheir
Copy link
Contributor

@koutheir koutheir commented Feb 14, 2023

The following JNI functions accept some UTF-8 strings as arguments:

  • FindClass
  • GetFieldID
  • GetMethodID
  • GetStaticFieldID
  • GetStaticMethodID
  • RegisterNatives

This patch checks that the UTF-8 strings provided to these methods are correctly encoded. If they are not, then the proper JNI error reporting behavior is performed, mainly:

  • FindClass throws NoClassDefFoundError.
  • GetFieldID and GetStaticFieldID throw NoSuchFieldError.
  • GetMethodID, GetStaticMethodID and RegisterNatives throw NoSuchMethodError.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Feb 14, 2023
@koutheir
Copy link
Contributor Author

The CI failure is unrelated to these changes.

@koutheir koutheir requested a review from peter-hofer April 18, 2023 13:19
@graalvmbot graalvmbot merged commit d7dbb4c into oracle:master May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants