Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

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

@lkho

Description

@lkho

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) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions