stream_wrap: error if stream has StringDecoder
authorFedor Indutny <fedor@indutny.com>
Sat, 5 Dec 2015 21:03:30 +0000 (16:03 -0500)
committerJames M Snell <jasnell@gmail.com>
Wed, 23 Dec 2015 16:38:33 +0000 (08:38 -0800)
commit6513a5ac5958f617e7de893d3c5022605573a659
treeaa56fe3501fb937814f72b6a1e41590fbb54edba
parent49b3c3b872b751947da903006316721ac0a77751
stream_wrap: error if stream has StringDecoder

If `.setEncoding` was called on input stream - all emitted `data` will
be `String`s instances, not `Buffer`s. This is unacceptable for
`StreamWrap`, and should not lead to the crash.

Fix: https://github.com/nodejs/node/issues/3970
PR-URL: https://github.com/nodejs/node/pull/4031
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
lib/_stream_wrap.js
test/parallel/test-stream-wrap-encoding.js [new file with mode: 0644]