kriszyp / msgpackr

Ultra-fast MessagePack implementation with extension for record and structural cloning / msgpack.org[JavaScript/NodeJS]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unpacking with bundled strings if few or no strings present throws "Data read, but end of buffer not reached"

o5k opened this issue · comments

commented

When unpacking packed data that has bundleStrings enabled, but no strings are actually bundled, it throws Data read, but end of buffer not reached.

Example:

const msgpackr = require('msgpackr');
const packr = new msgpackr.Packr({
	bundleStrings: true
});
const unpackr = new msgpackr.Unpackr({
	bundleStrings: true
});

unpackr.unpack(packr.pack({})); // throws
unpackr.unpack(packr.pack({a: 100, abc: 20})); // throws
unpackr.unpack(packr.pack({a: 100, abcd: 20})); // works

Looks like the last one actually starts using the bundled strings system, so it unpacks fine. But the ones without bundling (that end in 0xD4, 0x00, 0x00, 0xD4, 0x00, 0x00) fail to unpack.

Published fix in v1.6.2

commented

Can confirm working properly now! Thank you very much 🎉