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

Infinite loop in `unpackMultiple` with `bundleStrings: true`

yume-chan opened this issue · comments

Repro:

const { Packr } = require('msgpackr')

const options = {
  bundleStrings: true,
  sequential: true,
};

const packer = new Packr(options);
const unpacker = new Packr(options);

const data = { data: 42 }; // key length >= 4

unpacker.unpackMultiple(Buffer.concat([
  packer.pack(data),
  packer.pack(data)
]));

It never finishes and the memory usage continues growing, eventually it runs out of memory.

msgpackr version: 1.7.2
Node version: 16.15.1

This fix should be published in v1.8.0.