concordancejs / concordance

Compare, format, diff and serialize any JavaScript value
ISC License
207 stars 15 forks source link

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

Closed atesgoral closed 7 years ago

atesgoral commented 7 years ago

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

novemberborn commented 7 years ago

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

atesgoral commented 7 years ago

@novemberborn v6.0.0

atesgoral commented 7 years ago

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 :)

novemberborn commented 7 years ago

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