From 3e184df6e97610bccc96d2770ce8d2510e741d70 Mon Sep 17 00:00:00 2001 From: halgari Date: Sat, 13 Jan 2024 08:53:43 -0700 Subject: [PATCH] Fix a bounds error in RocksDBEventStore.cs --- src/NexusMods.EventSourcing.RocksDB/RocksDBEventStore.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/NexusMods.EventSourcing.RocksDB/RocksDBEventStore.cs b/src/NexusMods.EventSourcing.RocksDB/RocksDBEventStore.cs index f13b0937..3ad356d0 100644 --- a/src/NexusMods.EventSourcing.RocksDB/RocksDBEventStore.cs +++ b/src/NexusMods.EventSourcing.RocksDB/RocksDBEventStore.cs @@ -78,7 +78,10 @@ public override void EventsForEntity(EntityId entityId, TIngester ing BinaryPrimitives.WriteUInt64BigEndian(startKey.SliceFast(16), fromId.Value); Span endKey = stackalloc byte[24]; entityId.TryWriteBytes(endKey); - BinaryPrimitives.WriteUInt64BigEndian(endKey.SliceFast(16), toId.Value + 1); + if (toId == TransactionId.Max) + BinaryPrimitives.WriteUInt64BigEndian(endKey.SliceFast(16), ulong.MaxValue); + else + BinaryPrimitives.WriteUInt64BigEndian(endKey.SliceFast(16), toId.Value + 1); var options = new ReadOptions(); unsafe