-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Closed
Labels
fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.
Description
Given a file descriptor fd
that references a non-zero-length file, I expect this code to work:
var buf = new Buffer(0)
// Read zero bytes into offset 0 of `buf`
fs.read(fd, buf, 0, 0, 0, function(err, bytesRead, buffer) {
console.log('got buffer', buffer)
}
Instead it throws an exception because it assumes that offset
is out bounds because it starts at the end of the buffer (based on the buffer's length). If length
was a positive number, this would be out of bounds. But when length
is 0, an offset that starts at the end of the buffer is fine.
I expect a buffer of length zero to be returned in the callback, with no error, and no thrown exception.
Metadata
Metadata
Assignees
Labels
fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.