mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Better handling of overflowing integer values. r+sr=roc@ocallahan.org, a=beltzner@mozilla.com
This commit is contained in:
parent
cd55c6b951
commit
f9dab07ed0
@ -319,10 +319,18 @@ public:
|
||||
}
|
||||
|
||||
void AddRef() {
|
||||
if (mRefCnt == PR_UINT16_MAX) {
|
||||
NS_WARNING("refcount overflow, leaking nsCSSValue::Array");
|
||||
return;
|
||||
}
|
||||
++mRefCnt;
|
||||
NS_LOG_ADDREF(this, mRefCnt, "nsCSSValue::Array", sizeof(*this));
|
||||
}
|
||||
void Release() {
|
||||
if (mRefCnt == PR_UINT16_MAX) {
|
||||
NS_WARNING("refcount overflow, leaking nsCSSValue::Array");
|
||||
return;
|
||||
}
|
||||
--mRefCnt;
|
||||
NS_LOG_RELEASE(this, mRefCnt, "nsCSSValue::Array");
|
||||
if (mRefCnt == 0)
|
||||
|
@ -157,11 +157,22 @@ public:
|
||||
|
||||
~Assertion();
|
||||
|
||||
void AddRef() { ++mRefCnt; }
|
||||
void AddRef() {
|
||||
if (mRefCnt == PR_UINT16_MAX) {
|
||||
NS_WARNING("refcount overflow, leaking Assertion");
|
||||
return;
|
||||
}
|
||||
++mRefCnt;
|
||||
}
|
||||
|
||||
void Release(nsFixedSizeAllocator& aAllocator) {
|
||||
if (mRefCnt == PR_UINT16_MAX) {
|
||||
NS_WARNING("refcount overflow, leaking Assertion");
|
||||
return;
|
||||
}
|
||||
if (--mRefCnt == 0)
|
||||
Destroy(aAllocator, this); }
|
||||
Destroy(aAllocator, this);
|
||||
}
|
||||
|
||||
// For nsIRDFPurgeableDataSource
|
||||
inline void Mark() { u.as.mMarked = PR_TRUE; }
|
||||
@ -194,7 +205,7 @@ public:
|
||||
// also shared between hash/as (see the union above)
|
||||
// but placed after union definition to ensure that
|
||||
// all 32-bit entries are long aligned
|
||||
PRInt16 mRefCnt;
|
||||
PRUint16 mRefCnt;
|
||||
PRPackedBool mHashEntry;
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user