mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
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
@ -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 New Issue
Block a user