From e0caa301a55b8e3c81b6d31ecef2807712954ed2 Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 16 Aug 2020 02:57:31 +0300 Subject: [PATCH] TQueue: fix adding already expired events. GitOrigin-RevId: b78748cd001d9439c9e215b378b76b973a77a79a --- tddb/td/db/TQueue.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tddb/td/db/TQueue.cpp b/tddb/td/db/TQueue.cpp index 6c703de82..a126c7bd7 100644 --- a/tddb/td/db/TQueue.cpp +++ b/tddb/td/db/TQueue.cpp @@ -147,6 +147,9 @@ class TQueueImpl : public TQueue { if (q.total_event_length > MAX_TOTAL_EVENT_LENGTH - data.size()) { return Status::Error("Queue size is too big"); } + if (expires_at <= 0) { + return Status::Error("Failed to add already expired event"); + } EventId event_id; while (true) { if (q.tail_id.empty()) {