summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2021-03-23 12:19:42 -0400
committerNora Widdecke <nora@sequoia-pgp.org>2021-04-06 13:26:10 +0200
commit9c7e46aeba93f3206505cb819271487855ea091c (patch)
tree3aae08aed17317bedabde446ff816db4225ebb84
parente990add46c9acd1616ab3f03c6bd90f2dc5b541d (diff)
openpgp: Enable time_t overflow test on other 32-bit platforms.
on Debian GNU/Linux systems, time_t is 4 octets for i386 (rust calls this platform target_arch "x86"), armel ("arm"), armhf ("arm"), and mipsel ("mips"). I've pulled these arch names from platforms [0]. [0] https://github.com/RustSec/platforms-crate/blob/main/src/target/arch.rs There are likely other platforms that have a 32-bit time_t (and indeed, some variants of 32-bit platforms like musl may have a 64-bit time_t [1]), so this gating mechanism still isn't quite right. But it's an improvement over the status quo of just gating on target_arch = "x86". [1] https://musl.libc.org/time64.html
-rw-r--r--openpgp/src/types/timestamp.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/openpgp/src/types/timestamp.rs b/openpgp/src/types/timestamp.rs
index c253efbe..1d9c2b84 100644
--- a/openpgp/src/types/timestamp.rs
+++ b/openpgp/src/types/timestamp.rs
@@ -669,9 +669,9 @@ mod tests {
}
// #668
- // Ensure that, on x86, Timestamps between i32::MAX + 1 and u32::MAX are
+ // Ensure that, on 32-bit platforms, Timestamps between i32::MAX + 1 and u32::MAX are
// clamped down to i32::MAX, and values below are not altered.
- #[cfg(target_arch = "x86")]
+ #[cfg(any(target_arch = "x86", target_arch = "arm", target_arch = "mips"))]
#[test]
fn system_time_32_bit() -> Result<()> {
let t1 = Timestamp::from(u32::MAX);