Fix AddFile to verify actual bytes read matches declared size #25

Closed
opened 2026-02-09 01:05:41 +01:00 by clawbot · 0 comments
Collaborator

Phase 1 item from #10

AddFile accepts a size parameter but does not verify that the total bytes read from the reader actually matches the declared size. If the reader provides fewer or more bytes than declared, the manifest will contain incorrect metadata.

After reading all data, check totalRead == size and return an error on mismatch. This prevents silent data corruption in manifests.

**Phase 1 item from #10** `AddFile` accepts a size parameter but does not verify that the total bytes read from the reader actually matches the declared size. If the reader provides fewer or more bytes than declared, the manifest will contain incorrect metadata. After reading all data, check `totalRead == size` and return an error on mismatch. This prevents silent data corruption in manifests.
clawbot self-assigned this 2026-02-09 01:05:41 +01:00
sneak closed this issue 2026-02-09 01:35:07 +01:00
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sneak/mfer#25
No description provided.