mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-25 20:14:21 +01:00
There are two bugs in #1085. 1. `find_free_cell` accesses non-existent free blocks and returns their size to `allocate_space`. This is out of range access error. The fix is to add a loop termination condition that stops it when we hit the end of the blocks 2. This bug is caused by `find_free_cell` some how swallowing the blocks with size `4 bytes`. So `compute_free_space` consistently undercounts by `4 bytes`. I've refactored that part of the code to make sure 4 sized block are not deleted. I've also added a unit test which proves these fixes work and also added a function called `debug_print_freelist` which prints all free blocks of a page. For now I've silenced the `overflow_page` tests. Fixes #1085 Closes #1111