diff --git a/src/repository/manifest.rs b/src/repository/manifest.rs index b8b733f..49f6d44 100644 --- a/src/repository/manifest.rs +++ b/src/repository/manifest.rs @@ -420,10 +420,7 @@ impl FileAndHash { cons: &mut decode::Constructed ) -> Result, DecodeError> { cons.take_opt_sequence(|cons| { - cons.take_value_if( - Tag::IA5_STRING, - OctetString::from_content - )?; + let _ = Ia5String::take_from(cons)?; BitString::skip_in(cons)?; Ok(()) }) @@ -556,6 +553,20 @@ mod test { "../../test-data/repository/serde-compat/manifest.json" )).unwrap(); } + + #[test] + fn charset_violation() { + assert!( + Manifest::decode( + // This manifest is identical to ta.mft but has a non-ASCII + // character in the manifest filenames. + include_bytes!( + "../../test-data/repository/ta.mft.bad-filename" + ).as_ref(), + false, + ).is_err() + ); + } } #[cfg(all(test, feature = "softkeys"))] diff --git a/test-data/repository/ta.mft.bad-filename b/test-data/repository/ta.mft.bad-filename new file mode 100644 index 0000000..9770027 Binary files /dev/null and b/test-data/repository/ta.mft.bad-filename differ