private CacheEntry searchWithCacheMiss(Ruby runtime, final String id, final boolean cacheUndef) {
final int token = generation;
CacheEntry methodEntry = searchMethodEntryInner(id);
if (methodEntry == null) {
if (cacheUndef) {
return addToCache(id, UndefinedMethod.getInstance(), this, token);
}
return cacheEntryFactory.newCacheEntry(id, UndefinedMethod.getInstance(), methodEntry.sourceModule, token);
} else if (!runtime.isBooting()) {
addToCache(id, methodEntry);
}
return methodEntry;
}
Our SAST shows possible NullPointerException in https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/RubyModule.java#L2103
If
methodEntryis null, then dereference ofsourceModulewill cause NPE.Environment Information
We are analyzing versions 9.4.x (8-12), but this problem is still in master
Expected Behavior
Actual Behavior