mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 12:19:41 +00:00
Make our binary comparisons constant time (#2047)
This commit is contained in:
@@ -32,13 +32,13 @@
|
||||
if (ab1.byteLength !== ab2.byteLength) {
|
||||
return false;
|
||||
}
|
||||
var result = true;
|
||||
var result = 0;
|
||||
var ta1 = new Uint8Array(ab1);
|
||||
var ta2 = new Uint8Array(ab2);
|
||||
for (var i = 0; i < ab1.byteLength; ++i) {
|
||||
if (ta1[i] !== ta2[i]) { result = false; }
|
||||
result = result | ta1[i] ^ ta2[i];
|
||||
}
|
||||
return result;
|
||||
return result === 0;
|
||||
}
|
||||
|
||||
Whisper.Conversation = Backbone.Model.extend({
|
||||
|
||||
Reference in New Issue
Block a user