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

shallowSlice fix #44

Merged
merged 1 commit into from
May 1, 2017
Merged

shallowSlice fix #44

merged 1 commit into from
May 1, 2017

Conversation

yuri-kilochek
Copy link

@yuri-kilochek yuri-kilochek commented Apr 25, 2017

When start offset of shallowSlice does not fall on the start of the buffer, and both start and end fall on the same buffer, result contains extra trailing bytes. This happens because buffer start is adjusted first, thus invalidating computed internal end offsets, causing buffer end adjustment to produce incorrect results. Proposed fix simply adjusts first end, then start, as end adjustment has no effect on computed start offsets.

@yuri-kilochek
Copy link
Author

Workaround is to replace x.shallowSlice(s, e) with x.shallowSlice(s).shallowSlice(0, e - s).

@mcollina mcollina merged commit 391fd88 into rvagg:master May 1, 2017
@mcollina
Copy link
Collaborator

mcollina commented May 1, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants