mirror of
https://gitea.tendokyu.moe/beerpsi/fsdecrypt.git
synced 2026-09-22 22:17:55 +03:00
fix: extract exFAT OPTION containers that contain empty files
exfat-fs 0.1.3's StreamExtensionEntry::valid() rejects any entry with
FirstCluster < 2, but a zero-length file (or empty dir) legitimately has
FirstCluster = 0 / DataLength = 0 per the exFAT spec. The parser returned
InvalidStreamExtension and aborted the *entire* directory tree the moment it
hit one empty file, so real OPTION (.opt) containers failed to extract with:
WARNING: Failed to extract exfat contents: InvalidFileEntry(InvalidStreamExtension)
even though unsega/7-Zip read them fine.
0.1.3 is the latest published release and its `main` has an incompatible
public API, so override the dependency via [patch.crates-io] with a fork
branch that is the 0.1.3 release plus only the one-function fix (gate the
cluster check on DataLength: 0 -> FirstCluster must be 0, else >= 2).
Regenerate the synthetic OPTION fixture with a zero-byte file so tests/e2e.rs
reproduces the bug: without the patch it fails with InvalidStreamExtension;
with it, extraction succeeds. Verified against a real 191 MB OPTION container
(1602 files / 1217 dirs, empty file written as 0 bytes) and the full suite.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
47ca360f2e
commit
622aa537ee
Generated
+1
-2
@@ -481,8 +481,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "exfat-fs"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5cbdfa8ecf36ab2341032974d3644a56f1e40c9da3b643118492cf97f357f3c5"
|
||||
source = "git+https://github.com/jujuforce/exfat-fs.git?rev=7067f6afe3c21d9c737288475b29e5dae790e206#7067f6afe3c21d9c737288475b29e5dae790e206"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bytemuck",
|
||||
|
||||
+10
@@ -21,3 +21,13 @@ cipher = { version = "0.4.4", features = ["alloc"] }
|
||||
lto = "thin"
|
||||
codegen-units = 1
|
||||
strip = "none"
|
||||
|
||||
# exfat-fs 0.1.3 rejects empty (zero-length) files/dirs: its
|
||||
# StreamExtensionEntry::valid() treats FirstCluster < 2 as invalid, but an
|
||||
# empty file legitimately has FirstCluster = 0 / DataLength = 0. That aborts
|
||||
# the whole extraction the moment an OPTION container contains any 0-byte file.
|
||||
# Until the fix lands in a published release, override with a fork branch that
|
||||
# is the 0.1.3 release plus only that one-function fix (identical public API).
|
||||
# See https://github.com/jujuforce/exfat-fs/tree/v0.1.3-empty-file-fix
|
||||
[patch.crates-io]
|
||||
exfat-fs = { git = "https://github.com/jujuforce/exfat-fs.git", rev = "7067f6afe3c21d9c737288475b29e5dae790e206" }
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user