Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get/set on colums off by one #29

Closed
lukaswagner opened this issue Feb 3, 2022 · 0 comments · Fixed by #30
Closed

get/set on colums off by one #29

lukaswagner opened this issue Feb 3, 2022 · 0 comments · Fixed by #30
Assignees
Labels
bug Something isn't working

Comments

@lukaswagner
Copy link
Owner

lukaswagner commented Feb 3, 2022

The find predicate is wrong:
const chunk = this._chunks.find((c) => c.offset < index && c.offset + c.length >= index);
When reading index 0, no chunk is found, since the first chunk has offset 0, which is equal to the index. Thus, the lower check has to be changed to <=. Accordingly, the upper check has to be changed to >, as offset + length is already outside the chunk.

@lukaswagner lukaswagner added the bug Something isn't working label Feb 3, 2022
@lukaswagner lukaswagner self-assigned this Feb 3, 2022
lukaswagner added a commit that referenced this issue Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant