Possible NPE in UnboxableOpsAnalysisNode:getUnboxedVar() found by SAST · Issue #8812 · jruby/jruby · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
private TemporaryLocalVariable getUnboxedVar(Class reqdType, Map<Variable, TemporaryLocalVariable> unboxMap, Variable v, boolean createNew) {
TemporaryLocalVariable unboxedVar = unboxMap.get(v);
// FIXME: This is a bit broken -- SSA will eliminate this need for type verification
if ((unboxedVar == null && createNew) || !matchingTypes(reqdType, unboxedVar.getType())) {
unboxedVar = problem.getFIC().getNewUnboxedVariable(reqdType);
unboxMap.put(v, unboxedVar);
} else if (unboxedVar == null) {
// FIXME: throw an exception here
System.out.println("ERROR: No unboxed var for : " + v);
}
return unboxedVar;
}
If unboxedVar is null and createNew is false, then unboxedVar.getType() will cause NPE. And null unboxedVar is expectable condition, but appears to be unreachable.
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 condition exists at all
Actual Behavior
have no tests to show this NPE, can't figure out how to make one. This is simply code analysis, that showed possible NPE
The text was updated successfully, but these errors were encountered:
ngr-ilmarh
changed the title
Possible NPE in UnboxableOpsAnalysisNode:getUnboxedVar()
Possible NPE in UnboxableOpsAnalysisNode:getUnboxedVar() found by SAST
Apr 30, 2025
Our SAST shows possible NullPointerException in https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/ir/dataflow/analyses/UnboxableOpsAnalysisNode.java#L362
If
unboxedVar
is null andcreateNew
is false, thenunboxedVar.getType()
will cause NPE. And nullunboxedVar
is expectable condition, but appears to be unreachable.Environment Information
We are analyzing versions 9.4.x (8-12), but this problem is still in master
Expected Behavior
Actual Behavior
The text was updated successfully, but these errors were encountered: