From b1a6cfac0c244a1eb7ff876c0980cf9024455c13 Mon Sep 17 00:00:00 2001 From: ak88 Date: Thu, 9 Nov 2023 04:46:45 +0100 Subject: [PATCH] check table size greater than (#77) Check if table size is greater than buffer length, instead of the other way around. I run into an exception because i am flushing my compressor, and then write a chunk that is bigger, than what the buffer is can contain. Co-authored-by: Brant Burnett --- Snappier/Internal/HashTable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Snappier/Internal/HashTable.cs b/Snappier/Internal/HashTable.cs index 0edae1a..c3320dd 100644 --- a/Snappier/Internal/HashTable.cs +++ b/Snappier/Internal/HashTable.cs @@ -25,7 +25,7 @@ public void EnsureCapacity(int inputSize) var maxFragmentSize = Math.Min(inputSize, (int) Constants.BlockSize); var tableSize = CalculateTableSize(maxFragmentSize); - if (_buffer is null || tableSize < _buffer.Length) + if (_buffer is null || tableSize > _buffer.Length) { if (_buffer is not null) {