summaryrefslogtreecommitdiff
path: root/xpcom/glue/nsTArray.h
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2022-10-06 12:07:40 -0500
committerMatt A. Tobin <email@mattatobin.com>2022-10-06 12:07:40 -0500
commit6cdd0210fb14e8a1ed256e934f05f758afc4a6ab (patch)
treeae810fb774a340b2a3d4a0f8b6b9a68e6423e596 /xpcom/glue/nsTArray.h
parente4ed223f80260aa735a77bc4cfff25b76f3e7a94 (diff)
parent14f8e3e2e95e86a995627add57bf71de7c7edcaa (diff)
downloadaura-central-TRUNK.tar.gz
Merge branch 'EXTERNAL' into TRUNKHEADTRUNK
Diffstat (limited to 'xpcom/glue/nsTArray.h')
-rw-r--r--xpcom/glue/nsTArray.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/xpcom/glue/nsTArray.h b/xpcom/glue/nsTArray.h
index 22d6ab7b3..03913a376 100644
--- a/xpcom/glue/nsTArray.h
+++ b/xpcom/glue/nsTArray.h
@@ -2018,6 +2018,12 @@ auto
nsTArray_Impl<E, Alloc>::ReplaceElementsAt(index_type aStart, size_type aCount,
const Item* aArray, size_type aArrayLen) -> elem_type*
{
+ if (MOZ_UNLIKELY(aStart > Length())) {
+ InvalidArrayIndex_CRASH(aStart, Length());
+ }
+ if (MOZ_UNLIKELY(aCount > Length() - aStart)) {
+ InvalidArrayIndex_CRASH(aStart + aCount, Length());
+ }
// Adjust memory allocation up-front to catch errors.
if (!ActualAlloc::Successful(this->template EnsureCapacity<ActualAlloc>(
Length() + aArrayLen - aCount, sizeof(elem_type)))) {