Skip to content

Commit

Permalink
storage: fix integer overflow in max_timestamp
Browse files Browse the repository at this point in the history
Fixes redpanda-data#3924

(cherry picked from commit 3aacf0d)
  • Loading branch information
jcsp committed Mar 24, 2022
1 parent ace82c7 commit aebf86c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/v/storage/index_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ bool index_state::maybe_index(
// We know that a segment cannot be > 4GB
add_entry(
batch_base_offset() - base_offset(),
last_timestamp() - base_timestamp(),
std::max(last_timestamp() - base_timestamp(), int64_t{0}),
starting_position_in_file);

retval = true;
Expand Down

0 comments on commit aebf86c

Please sign in to comment.