stream: fix no data on partial decode
authorBrian White <mscdex@mscdex.net>
Sun, 14 Feb 2016 17:25:40 +0000 (12:25 -0500)
committerMyles Borins <mborins@us.ibm.com>
Mon, 21 Mar 2016 19:57:49 +0000 (12:57 -0700)
commit04db9efd7822a1d616aa64b783a7b191e6c228db
tree469b50fce914608aca237a58c8fd86308d51e751
parent9c51f3f37e0f08aac94c0304fea268453aa912cf
stream: fix no data on partial decode

Before this commit, it was possible to push a partial character
to a readable stream where it was decoded as an empty string and
then added to the internal buffer. This caused the stream to not
emit any data, even when the rest of the character bytes were pushed
separately, because of a non-zero length check of the first chunk in
the internal buffer.

Fixes: https://github.com/nodejs/node/issues/5223
PR-URL: https://github.com/nodejs/node/pull/5226
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
lib/_stream_readable.js
test/parallel/test-stream2-decode-partial.js [new file with mode: 0644]