Skip to content

Commit

Permalink
fix subtraction underflow in new_developer_log_line (#32127)
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 467ddad1de16b8cb9441a2d709eb100a61bdbb3a
  • Loading branch information
gautamg795 authored and Convex, Inc. committed Dec 11, 2024
1 parent 163e18f commit 48e8473
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/common/src/log_lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,11 @@ impl LogLineStructured {
timestamp: UnixTimestamp,
) -> Self {
// total length of messages joined by a space
let total_length = messages.iter().map(|m| m.len() + 1).sum::<usize>() - 1;
let total_length = messages
.iter()
.map(|m| m.len() + 1)
.sum::<usize>()
.saturating_sub(1);
if total_length <= MAX_LOG_LINE_LENGTH {
return Self {
messages: messages.into(),
Expand Down

0 comments on commit 48e8473

Please sign in to comment.