Closed gz65555 closed 1 year ago
Reproduction code:
... container.keyValue["info"] = new Uint8Array([0, 0, 0, 16]); const buffer = write(container); const newContainer = read(buffer);
The function _scan rely on NUL termination which is not correct:
_scan
_scan(maxByteLength: number, term = 0x00): Uint8Array { const byteOffset = this._offset; let byteLength = 0; while (this._dataView.getUint8(this._offset) !== term && byteLength < maxByteLength) { byteLength++; this._offset++; } if (byteLength < maxByteLength) this._offset++; return new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + byteOffset, byteLength); }
Thanks for reporting the bug! Would you be open to making a PR with a fix to support these values? And/or a failing unit test would also be helpful.
Reproduction code:
The function
_scan
rely on NUL termination which is not correct: