Our SAST shows possible NullPointerException in https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/util/StringSupport.java#L2178
if (opts != context.nil) {
IRubyObject _chomp = ArgsUtil.extractKeywordArg(context, "chomp", opts);
chomp = _chomp != null || _chomp.isTrue();
}
If _chomp is null, then _chomp.isTrue() will cause NPE
Environment Information
We are analyzing versions 9.4.x (8-12), but this problem is still in master
Expected Behavior
- No NPE at all. But it seems nobody catch it through the years, so i don't know if this variable can be null at all
Actual Behavior
- I have no tests to show this NPE, can't figure out how to make one. This is simply code analysis, that showed possible NPE
Our SAST shows possible NullPointerException in https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/util/StringSupport.java#L2178
If
_chompis null, then_chomp.isTrue()will cause NPEEnvironment Information
We are analyzing versions 9.4.x (8-12), but this problem is still in master
Expected Behavior
Actual Behavior