forked from mirrors/gecko-dev
Bug 1592325 - Fix an unsigned-integer underflow in HashTable.h that's super-easy to trigger using affirmatively wrapping operations. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D50960 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
1ed947aff2
commit
7d74f15a31
1 changed files with 2 additions and 1 deletions
|
|
@ -90,6 +90,7 @@
|
|||
#include "mozilla/ReentrancyGuard.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/WrappingOperations.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
@ -1700,7 +1701,7 @@ class HashTable : private AllocPolicy {
|
|||
|
||||
static HashNumber applyDoubleHash(HashNumber aHash1,
|
||||
const DoubleHash& aDoubleHash) {
|
||||
return (aHash1 - aDoubleHash.mHash2) & aDoubleHash.mSizeMask;
|
||||
return WrappingSubtract(aHash1, aDoubleHash.mHash2) & aDoubleHash.mSizeMask;
|
||||
}
|
||||
|
||||
static MOZ_ALWAYS_INLINE bool match(T& aEntry, const Lookup& aLookup) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue