Skip to content

Commit

Permalink
fix grpc: Check negative time in deadline
Browse files Browse the repository at this point in the history
Пример падения с отрицательным временем https://paste.yandex-team.ru/460211b7-96dd-4120-86df-b4c13b01cef9
  • Loading branch information
DmitriySud committed Jul 6, 2023
1 parent 5a6c6c0 commit 4fea138
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ namespace {

std::optional<engine::Deadline> TryExtractDeadline(
std::chrono::system_clock::time_point time) {
// In some versions of gRPC, absence of deadline represented as negative
// time_point
if (time.time_since_epoch().count() < 0) {
return std::nullopt;
}

const auto duration = time - std::chrono::system_clock::now();
if (duration >= std::chrono::hours{365 * 24}) {
return std::nullopt;
Expand Down

0 comments on commit 4fea138

Please sign in to comment.