Skip to content

node crashes if undefined passed to an objectMode readable stream #13753

@75lb

Description

@75lb
  • Version: v8.1.2
  • Platform: Darwin mbp.local 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64
  • Subsystem: Stream

The following code works on node v7 but crashes on v8:

const Transform = require('stream').Transform
const stream = new Transform({ objectMode: true })

function processChunk (chunk) { return undefined }

stream._transform = function (chunk, enc, done) {
  if (chunk) {
    this.push(processChunk(chunk))
  }
  done()
}

stream.end({ something: 'whatever' })

Node crashes if my processChunk function returns undefined (which it always does for the purpose of this test case), any other value works fine. However, the docs say that "For object mode streams, chunk may be any JavaScript value." If this is true, undefined should work fine, no?

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions