concordancejs / concordance

Compare, format, diff and serialize any JavaScript value

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RangeError: 'offset' is out of bounds when comparing empty (length 0) Buffers

atesgoral opened this issue · comments

Test case:

const c = require('concordance');

const a = Buffer.from([]);
const b = Buffer.from([]);

console.log(c.compare(a, b));

Output:

RangeError: 'offset' is out of bounds
at RangeError (native)
at fromArrayBuffer (buffer.js:257:20)
at Function.Buffer.from (buffer.js:128:12)
at getBuffer (lib/complexValues/typedArray.js:15:25)
at describe (lib/complexValues/typedArray.js:24:13)
at describeComplex (lib/describe.js:119:22)
at c (lib/describe.js:141:12)
at describe (lib/describe.js:168:10)
at Object.compare (lib/compare.js:98:12)

Version is 3.0.0

Hi @atesgoral. Which Node.js version are you using?

Just tested with 6.11.3 and the problem does not exist. So, maybe this is a non-issue. I didn't realize the particular environment I was using was stuck at version 6.0.0 for no valid reason :)

Interesting. It does look like a Node.js issue, yes.