added additional sanity checks to asn1_length() parsing