From f248610a583bcabb4cd6f5ff3bc3ee79631cf9e8 Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Thu, 13 Aug 2015 14:24:59 -0700 Subject: [PATCH] Bug 1193572, part 2 - nsXULPrototypeElement::Deserialize should use fallible SetCapacity. r=baku I think this prevents a crash if we end up with a bogus cache value. --- dom/xul/nsXULElement.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dom/xul/nsXULElement.cpp b/dom/xul/nsXULElement.cpp index 822c8237b4ba..175704c6549a 100644 --- a/dom/xul/nsXULElement.cpp +++ b/dom/xul/nsXULElement.cpp @@ -2318,7 +2318,9 @@ nsXULPrototypeElement::Deserialize(nsIObjectInputStream* aStream, uint32_t numChildren = int32_t(number); if (numChildren > 0) { - mChildren.SetCapacity(numChildren); + if (!mChildren.SetCapacity(numChildren, fallible)) { + return NS_ERROR_OUT_OF_MEMORY; + } for (uint32_t i = 0; i < numChildren; i++) { rv = aStream->Read32(&number);