summaryrefslogtreecommitdiffstats
path: root/dom/crypto/WebCryptoTask.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-02-08 14:04:54 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-02-08 14:04:54 +0100
commitbb828464e868b7571548f17ec3eaebd26f5078a2 (patch)
tree7bffaa4b17903de58996261ac465d08c601d6d85 /dom/crypto/WebCryptoTask.cpp
parent44cd9f2a915a4879371c5e0b059acc3e5a2378b0 (diff)
parent4099ff7494f2add95d35eb4ae0de12ab1fcf2aa2 (diff)
downloadUXP-bb828464e868b7571548f17ec3eaebd26f5078a2.tar
UXP-bb828464e868b7571548f17ec3eaebd26f5078a2.tar.gz
UXP-bb828464e868b7571548f17ec3eaebd26f5078a2.tar.lz
UXP-bb828464e868b7571548f17ec3eaebd26f5078a2.tar.xz
UXP-bb828464e868b7571548f17ec3eaebd26f5078a2.zip
Merge branch 'ported-upstream'
Diffstat (limited to 'dom/crypto/WebCryptoTask.cpp')
-rw-r--r--dom/crypto/WebCryptoTask.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/dom/crypto/WebCryptoTask.cpp b/dom/crypto/WebCryptoTask.cpp
index 57a7da186..f5fc7b5bc 100644
--- a/dom/crypto/WebCryptoTask.cpp
+++ b/dom/crypto/WebCryptoTask.cpp
@@ -716,6 +716,11 @@ private:
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
}
+ // Check whether the integer addition would overflow.
+ if (std::numeric_limits<CryptoBuffer::size_type>::max() - 16 < mData.Length()) {
+ return NS_ERROR_DOM_DATA_ERR;
+ }
+
// Initialize the output buffer (enough space for padding / a full tag)
uint32_t dataLen = mData.Length();
uint32_t maxLen = dataLen + 16;