Skip to content

Commit

Permalink
check table size greater than (#77)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ak88 and brantburnett authored Nov 9, 2023
1 parent a0c6ce1 commit b1a6cfa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Snappier/Internal/HashTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit b1a6cfa

Please sign in to comment.