-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
ipld::read does not use offset properly #542
Comments
raulk
added a commit
that referenced
this issue
May 12, 2022
raulk
added a commit
that referenced
this issue
May 12, 2022
raulk
added a commit
that referenced
this issue
May 12, 2022
raulk
added a commit
that referenced
this issue
May 12, 2022
This was referenced May 12, 2022
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Given a block id, ipld::read reads a block from the kernel’s BlockRegistry into a provided buffer. ipld::read also accepts an offset into the block where the read should begin.
offset is passed into Kernel::block_read, which first calculates the length of the read to perform before copying block data to the output buffer:
Neither operation correctly handles nonzero offsets:
buf.len().min(data.len() - offset)
buf[..len].copy_from_slice(...)
The text was updated successfully, but these errors were encountered: