From 81519fa91b68bf5afe2e7ff3524ea21c5f8f5519 Mon Sep 17 00:00:00 2001 From: Lapo Luchini Date: Sat, 18 Jan 2014 17:19:55 +0000 Subject: [PATCH] Improve checks. --- asn1.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/asn1.js b/asn1.js index 3bec169..b4c4e38 100644 --- a/asn1.js +++ b/asn1.js @@ -171,10 +171,13 @@ Stream.prototype.parseOID = function (start, end) { n = bits = 0; } } + if (bits > 0) + s += ".incomplete"; return s; }; function ASN1(stream, header, length, tag, sub) { + if (!(tag instanceof ASN1Tag)) throw 'Invalid tag value.'; this.stream = stream; this.header = header; this.length = length; @@ -182,8 +185,6 @@ function ASN1(stream, header, length, tag, sub) { this.sub = sub; } ASN1.prototype.typeName = function () { - if (this.tag === undefined) - return "unknown"; switch (this.tag.tagClass) { case 0: // universal switch (this.tag.tagNumber) { -- 2.51.2