zhuqi-lucas commented on code in PR #10449:
URL: https://github.com/apache/arrow-rs/pull/10449#discussion_r3733966266
##########
parquet/src/file/metadata/thrift/encryption.rs:
##########
@@ -163,10 +163,21 @@ fn row_group_from_encrypted_thrift(
}
};
+ // The ordinal is part of the AAD for encrypted column metadata.
+ // It can be missing here only for files with *mixed* row-group
+ // ordinals, which decode leaves untouched — fail cleanly rather
+ // than panic (see `ensure_row_group_ordinals`).
+ let rg_ordinal = rg.ordinal.ok_or_else(|| {
+ general_err!(
+ "Row group ordinal is required to decrypt column metadata
for \
+ column '{}', but the file's row-group ordinals are
inconsistent",
+ d.path().string()
+ )
+ })?;
let column_aad = crate::encryption::modules::create_module_aad(
decryptor.file_aad(),
crate::encryption::modules::ModuleType::ColumnMetaData,
- rg.ordinal.unwrap() as usize,
+ rg_ordinal as usize,
Review Comment:
Good call — done in this PR: switched to `usize::try_from(rg_ordinal)` so a
negative ordinal fails cleanly instead of sign-extending into a bogus AAD via
`as usize`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]