Skip to content

Commit 0be3dd6

Browse files
author
Cassiano
committed
Added ENSURE on ReadFull(): must read PAGE_SIZE bytes
1 parent a0aefbc commit 0be3dd6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

LiteDB/Engine/Disk/DiskService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,9 @@ public IEnumerable<PageBuffer> ReadFull(FileOrigin origin)
259259
{
260260
var position = stream.Position;
261261

262-
stream.Read(buffer, 0, PAGE_SIZE);
262+
var bytesRead = stream.Read(buffer, 0, PAGE_SIZE);
263+
264+
ENSURE(bytesRead == PAGE_SIZE, $"ReadFull must read PAGE_SIZE bytes [{bytesRead}]");
263265

264266
yield return new PageBuffer(buffer, 0, 0)
265267
{

0 commit comments

Comments
 (0)