fix(format): a v1 group with an empty link name fails its listing

libhdf5 refuses to list a symbol-table group that has an entry with an
empty name (H5G__ent_to_link: "invalid link name"), so h5py cannot list
cve-2021-46244's /BAG_root. We listed it, with an object at "/BAG_root/"
(the empty name, pointing at address 0). resolve_v1_group_entries — the
listing — now fails with the new FormatError::InvalidLinkName; path
lookups still find the group's other names, as libhdf5's by-name lookup
does.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
osobh
2026-09-26 10:15:50 -05:00
co-authored by Claude Opus 5.5
parent 1207df5189
commit 16b7359485
3 changed files with 50 additions and 4 deletions
+6
View File
@@ -223,6 +223,9 @@ pub enum FormatError {
/// The file's actual length in bytes.
actual_len: u64,
},
/// A link libhdf5 refuses to list: a symbol-table entry with an empty
/// name ("invalid link name"). Listing the group fails, as in libhdf5.
InvalidLinkName,
}
impl fmt::Display for FormatError {
@@ -494,6 +497,9 @@ impl fmt::Display for FormatError {
but the file is {actual_len} bytes"
)
}
FormatError::InvalidLinkName => {
write!(f, "invalid link name: a group entry has an empty name")
}
}
}
}