fix(format): resolve SOHM-shared messages on every path
A message shared through the file's SOHM heap (H5Pset_shared_mesg_index) is referenced by heap ID, which needs the SOHM table from the superblock extension. Only message_data_with_sohm (used for fill values) loaded it; resolve_shared_message passed no table, so a SOHM-shared datatype, dataspace, filter pipeline or attribute failed with "invalid shared message version: 2" and the dataset or attribute could not be read. resolve_shared_message now loads the table when the reference carries a heap ID. Found while making attrs() tolerant: SOHM attributes turned from an error into missing keys in the audit read matrix. With this fix all 36 SOHM cases there match h5py (datasets, fill values and attributes, every shareable message type, libver earliest and latest). Regression test: sohm_shared_messages_resolve (h5py writes files sharing each message type on its own and all of them; values and attributes checked). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
@@ -529,7 +529,8 @@ pub fn message_data<'a>(
|
||||
///
|
||||
/// For type 1/3 (shared in another object header), reads the target object header
|
||||
/// and finds the message of the specified type.
|
||||
/// For type 2 (SOHM), uses the fractal heap from the SOHM table.
|
||||
/// For type 2 (SOHM), uses the fractal heap from the file's SOHM table,
|
||||
/// loaded from the superblock extension on demand.
|
||||
pub fn resolve_shared_message(
|
||||
file_data: &[u8],
|
||||
shared_ref: &SharedMessageRef,
|
||||
@@ -537,13 +538,18 @@ pub fn resolve_shared_message(
|
||||
offset_size: u8,
|
||||
length_size: u8,
|
||||
) -> Result<Vec<u8>, FormatError> {
|
||||
let table = if shared_ref.heap_id.is_some() {
|
||||
load_sohm_table(file_data, offset_size, length_size)?
|
||||
} else {
|
||||
None
|
||||
};
|
||||
resolve_shared_message_with_sohm(
|
||||
file_data,
|
||||
shared_ref,
|
||||
target_msg_type,
|
||||
offset_size,
|
||||
length_size,
|
||||
None,
|
||||
table.as_ref(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user