From 9563ffc259808e26ce02098bb2b80ceeae74e014 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 16 Dec 2018 23:58:18 -0700 Subject: [PATCH] v1.1.7: bugfix (non-fatal) false positive error message --- asn1-parser.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/asn1-parser.js b/asn1-parser.js index 198c85a..3707863 100644 --- a/asn1-parser.js +++ b/asn1-parser.js @@ -29,7 +29,7 @@ ASN1.CTYPES = [ 0x30, 0x31, 0xa0, 0xa1 ]; ASN1.VTYPES = [ 0x01, 0x02, 0x05, 0x06, 0x0c, 0x82 ]; ASN1.parse = function parseAsn1Helper(buf) { //var ws = ' '; - function parseAsn1(buf, depth) { + function parseAsn1(buf, depth, eager) { if (depth.length >= ASN1.EDEEPN) { throw new Error(ASN1.EDEEP); } var index = 2; // we know, at minimum, data starts after type (0) and lengthSize (1) @@ -66,7 +66,7 @@ ASN1.parse = function parseAsn1Helper(buf) { while (iters < ASN1.ELOOPN && index < (2 + asn1.length + asn1.lengthSize)) { iters += 1; depth.length += 1; - child = parseAsn1(buf.slice(index, index + adjustedLen), depth); + child = parseAsn1(buf.slice(index, index + adjustedLen), depth, eager); depth.length -= 1; // The numbers don't match up exactly and I don't remember why... // probably something with adjustedLen or some such, but the tests pass @@ -92,7 +92,7 @@ ASN1.parse = function parseAsn1Helper(buf) { } // Recurse into types that are _always_ containers - if (-1 !== ASN1.CTYPES.indexOf(asn1.type)) { return parseChildren(); } + if (-1 !== ASN1.CTYPES.indexOf(asn1.type)) { return parseChildren(eager); } // Return types that are _always_ values asn1.value = buf.slice(index, index + adjustedLen); diff --git a/package.json b/package.json index aaa69ce..7e9f8e0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "asn1-parser", - "version": "1.1.6", + "version": "1.1.7", "description": "An ASN.1 parser in less than 100 lines of Vanilla JavaScript, part of the Bluecrypt suite.", "homepage": "https://git.coolaj86.com/coolaj86/asn1-parser.js", "main": "asn1-parser.js",