fuse-7z-ng: add patch to zero-init struct fuse_operations

Fixes segfault when reading archive files.

`struct fuse_operations` contains function pointers specifying a
filesystem's behavior for each operation. For unimplemented operations,
they must be set to null so that libfuse can fall back to a default
implementation or return an error. In fuse-7z-ng, however, they were
left uninitialized, causing segfault due to garbage values stored in
them.
This commit is contained in:
yvt 2023-04-07 23:04:07 +09:00
parent c816bd50aa
commit b121f98160
2 changed files with 15 additions and 0 deletions

View File

@ -14,6 +14,9 @@ stdenv.mkDerivation rec {
# Drop unused pthread library. pthread_yield()
# fails the configure.
./no-pthread.patch
# Zero-initialize unset fields of `struct fuse_operations` so that
# garbage values don't cause segfault.
./zero-init-fuse-operations.patch
];
nativeBuildInputs = [ pkg-config makeWrapper autoconf automake ];

View File

@ -0,0 +1,12 @@
Zero-initialize unset fields of `struct fuse_operations`.
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -195,7 +195,7 @@ main (int argc, char **argv)
mkdir(param.mountpoint, 0750);
}
- struct fuse_operations fuse7z_oper;
+ struct fuse_operations fuse7z_oper = {0};
fuse7z_oper.init = fuse7z_init;
fuse7z_oper.destroy = fuse7z_destroy;
fuse7z_oper.readdir = fuse7z_readdir;