From 562f14b05bdc79ea81dd5773b6992fd0e24229b3 Mon Sep 17 00:00:00 2001 From: Friedel Ziegelmayer Date: Fri, 28 Jul 2017 11:37:52 -0700 Subject: [PATCH] fix(decoder): handle larger arrays Closes #20 --- src/decoder.asm.js | 2 +- test/decoder.spec.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/decoder.asm.js b/src/decoder.asm.js index 8eaf7f17..3fc7a77e 100644 --- a/src/decoder.asm.js +++ b/src/decoder.asm.js @@ -490,7 +490,7 @@ module.exports = function decodeAsm (stdlib, foreign, buffer) { offset = (offset + 3) | 0 - return 1 + return 0 } function ARRAY_32 (octet) { diff --git a/test/decoder.spec.js b/test/decoder.spec.js index 23d66996..1e4ef9c8 100644 --- a/test/decoder.spec.js +++ b/test/decoder.spec.js @@ -126,6 +126,17 @@ describe('Decoder', function () { [largeInput] ) }) + + it('decode large arrays', () => { + const input = new Array(256).fill(1) + + expect( + cbor.decode(cbor.encode(input)) + ).to.be.eql( + input + ) + }) + // TODO: implement depth limit it.skip('depth', () => { expect(