From 74045d58d73975f99ae44f53ba322c684e90a737 Mon Sep 17 00:00:00 2001 From: Beaudan Brown Date: Tue, 12 Nov 2019 16:40:59 +1100 Subject: [PATCH] Use Int32 for the contact list buffer --- libloki/api.js | 2 +- libtextsecure/contacts_parser.js | 2 +- libtextsecure/test/contacts_parser_test.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libloki/api.js b/libloki/api.js index d699f1f6d..a78a0a218 100644 --- a/libloki/api.js +++ b/libloki/api.js @@ -114,7 +114,7 @@ buffers.forEach(buffer => { // bytebuffer container expands and increments // offset automatically - result.writeVarint32(buffer.limit); + result.writeInt32(buffer.limit); result.append(buffer); }); result.limit = result.offset; diff --git a/libtextsecure/contacts_parser.js b/libtextsecure/contacts_parser.js index 710faf6ae..4a4c38b69 100644 --- a/libtextsecure/contacts_parser.js +++ b/libtextsecure/contacts_parser.js @@ -14,7 +14,7 @@ ProtoParser.prototype = { if (this.buffer.limit === this.buffer.offset) { return undefined; // eof } - const len = this.buffer.readVarint32(); + const len = this.buffer.readInt32(); const nextBuffer = this.buffer .slice(this.buffer.offset, this.buffer.offset + len) .toArrayBuffer(); diff --git a/libtextsecure/test/contacts_parser_test.js b/libtextsecure/test/contacts_parser_test.js index be09e2bfd..16f70254c 100644 --- a/libtextsecure/test/contacts_parser_test.js +++ b/libtextsecure/test/contacts_parser_test.js @@ -18,7 +18,7 @@ describe('ContactBuffer', () => { const contactInfoBuffer = contactInfo.encode().toArrayBuffer(); for (let i = 0; i < 3; i += 1) { - buffer.writeVarint32(contactInfoBuffer.byteLength); + buffer.writeInt32(contactInfoBuffer.byteLength); buffer.append(contactInfoBuffer); buffer.append(avatarBuffer.clone()); } @@ -69,7 +69,7 @@ describe('GroupBuffer', () => { const groupInfoBuffer = groupInfo.encode().toArrayBuffer(); for (let i = 0; i < 3; i += 1) { - buffer.writeVarint32(groupInfoBuffer.byteLength); + buffer.writeInt32(groupInfoBuffer.byteLength); buffer.append(groupInfoBuffer); buffer.append(avatarBuffer.clone()); }