joyent/node — Issue #1882: zlib unpacking yields in assertion error
Author: andris9
Created: 2011-10-13 21:14:48+00:00
State: open

Node.js: v0.5.9, v0.5.8
Systems: OSX, Debian Lenny

When trying to unpack (`gunzip` or `inflte`) data with zlib, assertion error occurs.

Using he following script (slightly modified from the zlib section in node.js manual, `createGzip` changed to `createGunzip`) and the output length (unpacked.txt) should be 32kB or larger:

var zlib = require('zlib');
var gzip = zlib.createGunzip();
var fs = require('fs');
var inp = fs.createReadStream('packed.gz');
var out = fs.createWriteStream('unpacked.txt');

inp.pipe(gzip).pipe(out);

The following error occurs:

node: ../src/node_zlib.cc:104: static v8::Handle
node::ZCtx::Write(const v8::Arguments&) [with
node::node_zlib_mode mode = INFLATERAW]:
Assertion `in_off + in_len <= Buffer::Length(in_buf)' failed.
Aborted