Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Unified Diff: mojo/public/rust/tests/encoding.rs

Issue 2220183003: Rust: Add validation to decode (Closed) Base URL: git@github.com:domokit/mojo.git@coder-testing
Patch Set: Update from upstream branches (fixed arrays, validation code, etc.) Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/rust/src/bindings/run_loop.rs ('k') | mojo/public/rust/tests/regression.rs » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/rust/tests/encoding.rs
diff --git a/mojo/public/rust/tests/encoding.rs b/mojo/public/rust/tests/encoding.rs
index e315bec4a55fdf54b6e3f7248e5892eb34752819..5246203728665f90ce8d3c3b6498b5bda4c42a91 100644
--- a/mojo/public/rust/tests/encoding.rs
+++ b/mojo/public/rust/tests/encoding.rs
@@ -57,7 +57,7 @@ macro_rules! encoding_tests {
mock_handles.push(unsafe { system::acquire(0) });
}
println!("{}: Decoding header", stringify!($name));
- let header = MessageHeader::deserialize(&mut data[..], Vec::new());
+ let header = MessageHeader::deserialize(&mut data[..], Vec::new()).expect("Should not error");
let ctxt: Context = Default::default();
let header_size = header.serialized_size(&ctxt);
let header_cls = $header_cls;
@@ -66,13 +66,13 @@ macro_rules! encoding_tests {
let payload_buffer = &mut data[header_size..];
let cls = $cls;
println!("{}: Decoding payload", stringify!($name));
- let decoded_payload = $req_type::deserialize(payload_buffer, mock_handles);
+ let decoded_payload = $req_type::deserialize(payload_buffer, mock_handles).expect("Should not error");
println!("{}: Verifying decoded payload", stringify!($name));
cls(&decoded_payload);
println!("{}: Re-encoding payload", stringify!($name));
let (mut encoded_payload, handles) = decoded_payload.auto_serialize();
println!("{}: Decoding payload again", stringify!($name));
- let redecoded_payload = $req_type::deserialize(&mut encoded_payload[..], handles);
+ let redecoded_payload = $req_type::deserialize(&mut encoded_payload[..], handles).expect("Should not error");
println!("{}: Verifying decoded payload again", stringify!($name));
cls(&redecoded_payload);
},
« no previous file with comments | « mojo/public/rust/src/bindings/run_loop.rs ('k') | mojo/public/rust/tests/regression.rs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698