mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 21:36:29 +03:00
Use saturating addition for ephemeral timers
Integer overflows crash the application by default. On a first sight this is only a potential crash that can't be triggered, because timestamps are stored as i64 and ephemeral timer duration is u32.
This commit is contained in:
@@ -1222,7 +1222,7 @@ impl Chat {
|
||||
};
|
||||
let ephemeral_timestamp = match ephemeral_timer {
|
||||
EphemeralTimer::Disabled => 0,
|
||||
EphemeralTimer::Enabled { duration } => time() + i64::from(duration),
|
||||
EphemeralTimer::Enabled { duration } => time().saturating_add(duration.into()),
|
||||
};
|
||||
|
||||
let new_mime_headers = if msg.has_html() {
|
||||
|
||||
Reference in New Issue
Block a user