cryptomator / jfuse

Java bindings for FUSE using the FFM API
GNU Lesser General Public License v3.0
38 stars 2 forks source link

Fix SIGSEV crashes by adding NULL pointer checks #39

Closed infeo closed 11 months ago

infeo commented 11 months ago

According to the fuse 3.x documentation, the methods releasedir, getattr, chmod, chown, fsyncdir, truncate and utimens can have NULL parameter. Before this PR this was not accounted for, leading to crashes of the JVM.

This PR fixes it. If the MemorySegment handed over to the JVM is the NULL-Pointer, the methods translate it to Javas null value.

overheadhunter commented 11 months ago

Also, can you add tests for the new utility methods?

infeo commented 11 months ago

What about fi in macOS? Is it always non-null in fuse 2?

In fuse 2 the above methods either do not have a file info as parameter or the documentation only mentions the path to be nullable.

infeo commented 11 months ago

Also, can you add tests for the new utility methods?

@overheadhunter Done in https://github.com/cryptomator/jfuse/pull/39/commits/c3bb1540f6a5f9e869af1c928e8d66f93afc4327