mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1237201 part 2 - Handle Vector OOM in gfx/. r=jrmuizel,kats
This commit is contained in:
parent
2f5d0b359f
commit
b435184515
@ -31,7 +31,9 @@ int32_t
|
||||
PreferenceAccess::RegisterLivePref(const char* aName, int32_t* aVar,
|
||||
int32_t aDefault)
|
||||
{
|
||||
Int32Prefs().append(Int32Pref{ aName, aVar });
|
||||
if (!Int32Prefs().append(Int32Pref{ aName, aVar })) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
return aDefault;
|
||||
}
|
||||
|
||||
@ -57,4 +59,4 @@ PreferenceAccess::SetAccess(PreferenceAccess* aAccess)
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace mozilla
|
||||
} // namespace mozilla
|
||||
|
@ -194,7 +194,9 @@ SFNTData::GetU16FullNames(Vector<mozilla::u16string>& aU16FullNames)
|
||||
if (mFonts[i]->GetU16FullName(name)) {
|
||||
fontFound = true;
|
||||
}
|
||||
aU16FullNames.append(Move(name));
|
||||
if (!aU16FullNames.append(Move(name))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return fontFound;
|
||||
|
@ -128,37 +128,45 @@ CreateCanonicalU16Matchers(const BigEndianUint16& aNameID)
|
||||
NameRecordMatchers *matchers = new NameRecordMatchers();
|
||||
|
||||
// First, look for the English name (this will normally succeed).
|
||||
matchers->append(
|
||||
if (!matchers->append(
|
||||
[=](const NameRecord *aNameRecord) {
|
||||
return aNameRecord->nameID == aNameID &&
|
||||
aNameRecord->languageID == CANONICAL_LANG_ID &&
|
||||
aNameRecord->platformID == PLATFORM_ID &&
|
||||
IsUTF16Encoding(aNameRecord);
|
||||
});
|
||||
})) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
// Second, look for all languages.
|
||||
matchers->append(
|
||||
if (!matchers->append(
|
||||
[=](const NameRecord *aNameRecord) {
|
||||
return aNameRecord->nameID == aNameID &&
|
||||
aNameRecord->platformID == PLATFORM_ID &&
|
||||
IsUTF16Encoding(aNameRecord);
|
||||
});
|
||||
})) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
// On Mac may be dealing with font that only has Microsoft name entries.
|
||||
matchers->append(
|
||||
if (!matchers->append(
|
||||
[=](const NameRecord *aNameRecord) {
|
||||
return aNameRecord->nameID == aNameID &&
|
||||
aNameRecord->languageID == LANG_ID_MICROSOFT_EN_US &&
|
||||
aNameRecord->platformID == PLATFORM_ID_MICROSOFT &&
|
||||
IsUTF16Encoding(aNameRecord);
|
||||
});
|
||||
matchers->append(
|
||||
})) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
if (!matchers->append(
|
||||
[=](const NameRecord *aNameRecord) {
|
||||
return aNameRecord->nameID == aNameID &&
|
||||
aNameRecord->platformID == PLATFORM_ID_MICROSOFT &&
|
||||
IsUTF16Encoding(aNameRecord);
|
||||
});
|
||||
})) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
#endif
|
||||
|
||||
return matchers;
|
||||
|
@ -516,9 +516,11 @@ public:
|
||||
// while holding mMonitor, because otherwise, if the overscrolled APZC
|
||||
// is this one, then the SetState(NOTHING) in UpdateAnimation will
|
||||
// stomp on the SetState(SNAP_BACK) it does.
|
||||
mDeferredTasks.append(NewRunnableMethod(mOverscrollHandoffChain.get(),
|
||||
&OverscrollHandoffChain::SnapBackOverscrolledApzc,
|
||||
&mApzc));
|
||||
if (!mDeferredTasks.append(NewRunnableMethod(mOverscrollHandoffChain.get(),
|
||||
&OverscrollHandoffChain::SnapBackOverscrolledApzc,
|
||||
&mApzc))) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -567,11 +569,13 @@ public:
|
||||
// the lock ordering. Instead we schedule HandleFlingOverscroll() to be
|
||||
// called after mMonitor is released.
|
||||
APZC_LOG("%p fling went into overscroll, handing off with velocity %s\n", &mApzc, Stringify(velocity).c_str());
|
||||
mDeferredTasks.append(NewRunnableMethod(&mApzc,
|
||||
&AsyncPanZoomController::HandleFlingOverscroll,
|
||||
velocity,
|
||||
mOverscrollHandoffChain,
|
||||
mScrolledApzc));
|
||||
if (!mDeferredTasks.append(NewRunnableMethod(&mApzc,
|
||||
&AsyncPanZoomController::HandleFlingOverscroll,
|
||||
velocity,
|
||||
mOverscrollHandoffChain,
|
||||
mScrolledApzc))) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
// If there is a remaining velocity on this APZC, continue this fling
|
||||
// as well. (This fling and the handed-off fling will run concurrently.)
|
||||
@ -796,9 +800,11 @@ public:
|
||||
// HandleSmoothScrollOverscroll() (which acquires the tree lock) would violate
|
||||
// the lock ordering. Instead we schedule HandleSmoothScrollOverscroll() to be
|
||||
// called after mMonitor is released.
|
||||
mDeferredTasks.append(NewRunnableMethod(&mApzc,
|
||||
&AsyncPanZoomController::HandleSmoothScrollOverscroll,
|
||||
velocity));
|
||||
if (!mDeferredTasks.append(NewRunnableMethod(&mApzc,
|
||||
&AsyncPanZoomController::HandleSmoothScrollOverscroll,
|
||||
velocity))) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -1197,7 +1197,9 @@ EncodeSourceSurfaceInternal(SourceSurface* aSurface,
|
||||
&numReadThisTime)) == NS_OK && numReadThisTime > 0)
|
||||
{
|
||||
// Update the length of the vector without overwriting the new data.
|
||||
imgData.growByUninitialized(numReadThisTime);
|
||||
if (!imgData.growByUninitialized(numReadThisTime)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
imgSize += numReadThisTime;
|
||||
if (imgSize == bufSize) {
|
||||
|
Loading…
Reference in New Issue
Block a user