diff options
author | Jeff Vander Stoep <jeffv@google.com> | 2023-03-06 15:33:04 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-03-06 15:33:04 +0000 |
commit | d481135794e26256eab5d53995fd8ac00dfceb39 (patch) | |
tree | b8801f3940d540a59a9ad38da00f06557ab0cf6e | |
parent | dd2020d52a90ec6ce67e2d3c3b24a5b584af050a (diff) | |
parent | 533cfefd5eff33cc3533e8850f3a7744d2922aaa (diff) | |
download | const-oid-d481135794e26256eab5d53995fd8ac00dfceb39.tar.gz |
Upgrade const-oid to 0.9.2 am: f46e813870 am: 5d6b5f5193 am: 533cfefd5e
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/const-oid/+/2469803
Change-Id: If7b68bd82fa2777752b63a28d4ebab7f8b704666
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | Android.bp | 6 | ||||
-rw-r--r-- | Cargo.toml | 7 | ||||
-rw-r--r-- | Cargo.toml.orig | 5 | ||||
-rw-r--r-- | METADATA | 10 | ||||
-rw-r--r-- | src/lib.rs | 26 |
6 files changed, 43 insertions, 13 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 80de78a..9b0b48f 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,6 +1,6 @@ { "git": { - "sha1": "252671f5828a6df3c1a31222519cd278c8704e4b" + "sha1": "6489ca88e5d26fd2f754679ed5d511b817eb20d1" }, "path_in_vcs": "const-oid" }
\ No newline at end of file @@ -35,13 +35,9 @@ rust_library_host { name: "libconst_oid", crate_name: "const_oid", cargo_env_compat: true, - cargo_pkg_version: "0.9.1", + cargo_pkg_version: "0.9.2", srcs: ["src/lib.rs"], edition: "2021", features: ["db"], - apex_available: [ - "//apex_available:platform", - "com.android.virt", - ], vendor_available: true, } @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.57" name = "const-oid" -version = "0.9.1" +version = "0.9.2" authors = ["RustCrypto Developers"] description = """ Const-friendly implementation of the ISO/IEC Object Identifier (OID) standard @@ -45,6 +45,11 @@ rustdoc-args = [ "docsrs", ] +[dependencies.arbitrary] +version = "1.2" +features = ["derive"] +optional = true + [dev-dependencies.hex-literal] version = "0.3" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index ffc05e6..93f81dd 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "const-oid" -version = "0.9.1" +version = "0.9.2" authors = ["RustCrypto Developers"] license = "Apache-2.0 OR MIT" description = """ @@ -16,6 +16,9 @@ readme = "README.md" edition = "2021" rust-version = "1.57" +[dependencies] +arbitrary = { version = "1.2", optional = true, features = ["derive"] } + [dev-dependencies] hex-literal = "0.3" @@ -11,13 +11,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/const-oid/const-oid-0.9.1.crate" + value: "https://static.crates.io/crates/const-oid/const-oid-0.9.2.crate" } - version: "0.9.1" + version: "0.9.2" license_type: NOTICE last_upgrade_date { - year: 2022 - month: 12 - day: 8 + year: 2023 + month: 3 + day: 6 } } @@ -256,3 +256,29 @@ impl fmt::Display for ObjectIdentifier { Ok(()) } } + +// Implement by hand because the derive would create invalid values. +// Use the constructor to create a valid oid with at least 3 arcs. +#[cfg(feature = "arbitrary")] +impl<'a> arbitrary::Arbitrary<'a> for ObjectIdentifier { + fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> { + let first = u.int_in_range(0..=arcs::ARC_MAX_FIRST)?; + let second = u.int_in_range(0..=arcs::ARC_MAX_SECOND)?; + let third = u.arbitrary()?; + + let mut oid = Self::from_arcs([first, second, third]) + .map_err(|_| arbitrary::Error::IncorrectFormat)?; + + for arc in u.arbitrary_iter()? { + oid = oid + .push_arc(arc?) + .map_err(|_| arbitrary::Error::IncorrectFormat)?; + } + + Ok(oid) + } + + fn size_hint(depth: usize) -> (usize, Option<usize>) { + (Arc::size_hint(depth).0.saturating_mul(3), None) + } +} |