From c7cea04abae21cb8a9c574d6801735811cd52108 Mon Sep 17 00:00:00 2001 From: Martin Sumner Date: Thu, 8 Feb 2018 15:31:35 +0000 Subject: [PATCH] Correct maximum length --- src/leveled_sst.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/leveled_sst.erl b/src/leveled_sst.erl index e232372..d0ac95a 100644 --- a/src/leveled_sst.erl +++ b/src/leveled_sst.erl @@ -1519,11 +1519,11 @@ crc_check_slot(FullBin) -> PosBL:32/integer, CRC32H:32/integer, Rest/binary>> = FullBin, - PosBL0 = min(PosBL, byte_size(FullBin) - 4), + PosBL0 = min(PosBL, byte_size(FullBin) - 3), % If the position has been bit-flipped to beyond the maximum paossible % length, use the maximum possible length <> = Rest, - case {hmac(Header), hmac(PosBL)} of + case {hmac(Header), hmac(PosBL0)} of {CRC32H, CRC32PBL} -> {Header, Blocks}; _ ->