diff options
author | Matt A. Tobin <email@mattatobin.com> | 2022-10-06 12:07:40 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2022-10-06 12:07:40 -0500 |
commit | 6cdd0210fb14e8a1ed256e934f05f758afc4a6ab (patch) | |
tree | ae810fb774a340b2a3d4a0f8b6b9a68e6423e596 /xpcom/glue/nsTArray.h | |
parent | e4ed223f80260aa735a77bc4cfff25b76f3e7a94 (diff) | |
parent | 14f8e3e2e95e86a995627add57bf71de7c7edcaa (diff) | |
download | aura-central-6cdd0210fb14e8a1ed256e934f05f758afc4a6ab.tar.gz |
Diffstat (limited to 'xpcom/glue/nsTArray.h')
-rw-r--r-- | xpcom/glue/nsTArray.h | 6 |
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)))) { |