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

net/streams: don't return the stream object from onStreamRead #34375

Closed
wants to merge 10 commits into from
11 changes: 8 additions & 3 deletions lib/internal/stream_base_commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ function onStreamRead(arrayBuffer) {
}

if (nread !== UV_EOF) {
return stream.destroy(errnoException(nread, 'read'));
// #34375 CallJSOnreadMethod expects the return value to be a buffer.
stream.destroy(errnoException(nread, 'read'));
return;
robey marked this conversation as resolved.
Show resolved Hide resolved
}

// Defer this until we actually emit end
Expand All @@ -225,8 +227,11 @@ function onStreamRead(arrayBuffer) {
// test-https-truncate test.
if (handle.readStop) {
const err = handle.readStop();
if (err)
return stream.destroy(errnoException(err, 'read'));
if (err) {
// #34375 CallJSOnreadMethod expects the return value to be a buffer.
stream.destroy(errnoException(err, 'read'));
return;
robey marked this conversation as resolved.
Show resolved Hide resolved
}
}

// Push a null to signal the end of data.
Expand Down