Ensure that message.previousCounter can never go below zero

This commit is contained in:
Scott Nonnenberg 2020-01-29 14:13:50 -08:00 committed by GitHub
parent 7461250caf
commit de630a2ea8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -36092,6 +36092,9 @@ SessionCipher.prototype = {
delete chain.messageKeys[chain.chainKey.counter];
msg.counter = chain.chainKey.counter;
msg.previousCounter = session.currentRatchet.previousCounter;
if (msg.previousCounter < 0) {
msg.previousCounter = 0;
}
return Internal.crypto.encrypt(
keys[0], buffer, keys[2].slice(0, 16)