Skip to content

Commit

Permalink
fix(decoder): handle larger arrays
Browse files Browse the repository at this point in the history
Closes #20
  • Loading branch information
dignifiedquire authored Jul 28, 2017
1 parent b9eafd8 commit 562f14b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/decoder.asm.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ module.exports = function decodeAsm (stdlib, foreign, buffer) {

offset = (offset + 3) | 0

return 1
return 0
}

function ARRAY_32 (octet) {
Expand Down
11 changes: 11 additions & 0 deletions test/decoder.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 562f14b

Please sign in to comment.