-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed as not planned
Milestone
Description
Our SAST shows possible NullPointerException in
| if (posix.isNative() && !Platform.IS_WINDOWS) { |
public Channel openChannel(final int flags, int perm) throws IOException {
final ModeFlags modeFlags = ModeFlags.createModeFlags(flags);
if (posix.isNative() && !Platform.IS_WINDOWS) {
int fd = posix.open(absolutePath(), modeFlags.getFlags(), perm);
if (fd < 0) throwFromErrno(posix.errno());
posix.fcntlInt(fd, Fcntl.F_SETFD, posix.fcntl(fd, Fcntl.F_GETFD) | FcntlLibrary.FD_CLOEXEC);
return new NativeDeviceChannel(fd, true);
}
if (modeFlags.isCreate()) {
...
// attempt to set the permissions, if we have been passed a POSIX instance,
// perm is > 0, and only if the file was created in this call.
if (fileCreated && posix != null) {
perm = perm & ~PosixShim.umask(posix);
if (perm > 0) posix.chmod(file.getPath(), perm);
}
return channel;
}
...
If posix can be null, then it should cause NPE in posix.isNative()
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels