Improvements based on SAST null reference reports#8895
Merged
headius merged 6 commits intojruby:masterfrom Jul 7, 2025
Merged
Conversation
All callers pass in a non-null Encoding array, so let's make this invariant and avoid any external callers. Part of fixes for jruby#8840.
The null check here appears to be intended in the CRuby code to check whether the given encoding name has already been set, and return true if the new encoding would overwrite it. This is not currently consumed by any code. The switch to a lambda here avoids allocating the def_p out array. The value originally put in that array is only used to set either the default internal or default external encoding, which can be done in a lambda. Part of improvements for jruby#8840
Both branches of the CFG null check below required the CFG to be non-null, the second via the call to fic.toStringInstrs. Since we have not seen NPE here, the CFG appears to never be null in our uses of this listener, so ensure that is true with a hard check and remove the null path. Part of fixes for jruby#8840
Part of fixes for jruby#8840
Part of fixes for jruby#8840
This buildProcess was supposed to have been removed in 61ac7f3 but appears to have been missed. This case is especially bad because it would lead to the process being launched twice. Part of fixes for jruby#8840
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The handful of NPE issues found by the SAST tool in #8840 are worth a look, so I'm fixing them here.