This repository was archived by the owner on Jun 17, 2025. It is now read-only.
[WIP] Fix crashes when passing arrays via reflection - #191
Open
aoli-al wants to merge 1 commit into
Open
Conversation
Collaborator
|
Yes, I've run into this one before, too :/ I haven't had a chance yet to run and step through your failing test case, but I think that for the case of reflection, this is not the right direction to be going. We should be intercepting reflective calls and ensuring that primitive arrays are represented by their corresponding wrappers. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a method signature has Object type and it receives an array via reflection, Phosphor cannot identify this and will lead to
java.lang.ClassCastException.Initially I was planning to simply expand this check for all methods
phosphor/Phosphor/src/main/java/edu/columbia/cs/psl/phosphor/instrumenter/TaintPassingMV.java
Line 135 in 177ab28
It seems not working because it calls Phosphor inside JDK when JVM is initialized (and cause another crash). It seems that we need to maintain an allow list either:
It seems plan 2 is more robust but building that list exhaustively is hard. Please let me know what you think and I'm happy to bring a patch.
Ps. if you want to see a realistic example, the class is
https://github.com/openjdk/jdk/blob/a39cf2e3b242298fbf5fafdb8aa9b5d4562061ef/src/java.base/share/classes/sun/security/x509/BasicConstraintsExtension.java#L114