mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1290350 - Make fallible some potentially large allocations in nsSimpleURI::GetSpec. r=valentin.
--HG-- extra : rebase_source : afb8e8a177eb171db1977ca8414eb01a6cd68838
This commit is contained in:
parent
249cd65c71
commit
6fa37ab6c0
@ -167,9 +167,17 @@ nsSimpleURI::Deserialize(const URIParams& aParams)
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::GetSpec(nsACString &result)
|
||||
{
|
||||
result = mScheme + NS_LITERAL_CSTRING(":") + mPath;
|
||||
if (!result.Assign(mScheme, fallible) ||
|
||||
!result.Append(NS_LITERAL_CSTRING(":"), fallible) ||
|
||||
!result.Append(mPath, fallible)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (mIsRefValid) {
|
||||
result += NS_LITERAL_CSTRING("#") + mRef;
|
||||
if (!result.Append(NS_LITERAL_CSTRING("#"), fallible) ||
|
||||
!result.Append(mRef, fallible)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
} else {
|
||||
MOZ_ASSERT(mRef.IsEmpty(), "mIsRefValid/mRef invariant broken");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user