diff options
author | Hubert Chathi <hubert@uhoreg.ca> | 2019-04-08 15:54:02 -0400 |
---|---|---|
committer | Hubert Chathi <hubert@uhoreg.ca> | 2019-04-08 15:54:02 -0400 |
commit | ebc156e7c272e08e375c3e704651b179541e078b (patch) | |
tree | ca421f9d429f009e1c939bf96314fd4764ae241b /javascript/olm_pre.js | |
parent | 071029c20174307de28ca20232196f83fcc37763 (diff) |
re-add null termination in javascript
because older versions of emscripten don't support the length argument to
UTF8ToString.
Diffstat (limited to 'javascript/olm_pre.js')
-rw-r--r-- | javascript/olm_pre.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/javascript/olm_pre.js b/javascript/olm_pre.js index 7153f7a..314d7da 100644 --- a/javascript/olm_pre.js +++ b/javascript/olm_pre.js @@ -30,6 +30,14 @@ if (typeof(OLM_OPTIONS) !== 'undefined') { } } +/* The 'length' argument to Pointer_stringify doesn't work if the input + * includes characters >= 128, which makes Pointer_stringify unreliable. We + * could use it on strings which are known to be ascii, but that seems + * dangerous. Instead we add a NULL character to all of our strings and just + * use UTF8ToString. + */ +var NULL_BYTE_PADDING_LENGTH = 1; + Module['onRuntimeInitialized'] = function() { OLM_ERROR = Module['_olm_error'](); olm_exports["PRIVATE_KEY_LENGTH"] = Module['_olm_pk_private_key_length'](); |