To this end, when we de-serialise a block into a list of KV pairs, we return an empty list if the CRC check fails:
https://github.com/martinsumner/leveled/tree/5bef21d9719a561beeaf735e168bd140d9771e38/src/leveled_sst.erl#L1391-L1399
But when we have an indexed lookup on a block we look at the exact position in the block:
https://github.com/martinsumner/leveled/tree/5bef21d9719a561beeaf735e168bd140d9771e38/src/leveled_sst.erl#L1696-L1697
and this is crashing with the empty list.
Elsewhere in leveled_sst the functions fetchfrom_rawblock/2 and fetchend_rawblock/2 are used to counter this issue.
This issue will cause a database crash on an invalid block - which is not expected.
To this end, when we de-serialise a block into a list of KV pairs, we return an empty list if the CRC check fails:
https://github.com/martinsumner/leveled/tree/5bef21d9719a561beeaf735e168bd140d9771e38/src/leveled_sst.erl#L1391-L1399
But when we have an indexed lookup on a block we look at the exact position in the block:
https://github.com/martinsumner/leveled/tree/5bef21d9719a561beeaf735e168bd140d9771e38/src/leveled_sst.erl#L1696-L1697
and this is crashing with the empty list.
Elsewhere in leveled_sst the functions
fetchfrom_rawblock/2andfetchend_rawblock/2are used to counter this issue.This issue will cause a database crash on an invalid block - which is not expected.