1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 03:47:34 +00:00

LibSQL: Prevent writing to free heap blocks

Each block index should have been requested before a write happens to
it. If this is not the case, return an error.
This commit is contained in:
Jelle Raaijmakers 2023-06-13 21:52:10 +02:00 committed by Tim Flynn
parent d3335d6ef8
commit c05e08decb
2 changed files with 7 additions and 2 deletions

View file

@ -186,6 +186,7 @@ TEST_CASE(heap_free_storage)
TRY_OR_FAIL(heap->free_storage(storage_block_id));
// Again, write some large storage spanning multiple blocks
storage_block_id = heap->request_new_block_index();
TRY_OR_FAIL(heap->write_storage(storage_block_id, long_string.bytes()));
MUST(heap->flush());
auto new_heap_size = MUST(heap->file_size_in_bytes());