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

ReadStream: incorrect validation of range.endPos when endPos is 0 #142

Open
lkho opened this issue Jan 15, 2019 · 0 comments
Open

ReadStream: incorrect validation of range.endPos when endPos is 0 #142

lkho opened this issue Jan 15, 2019 · 0 comments

Comments

@lkho
Copy link

lkho commented Jan 15, 2019

when specifying { endPos: 0 }, it is converted to position - 1. However, it is indeed valid since startPos/endPos is inclusive.

if (err) return self._error(err);
// Calculate the correct end position either from EOF or end of range. Also handle incorrect range request.
if (!self.range.endPos || self.range.endPos > position-1) {self.range.endPos = position - 1};
// Set the read head to the beginning of the file or start position if specified
self._store.seek(self.range.startPos, self._grid.mongo.GridStore.IO_SEEK_SET, function(err) {

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

No branches or pull requests

1 participant