summaryrefslogtreecommitdiff
path: root/src/third_party
diff options
context:
space:
mode:
authorJason Carey <jcarey@argv.me>2015-09-16 18:18:46 -0400
committerJason Carey <jcarey@argv.me>2015-09-21 18:25:39 -0400
commitee4f910322988cb9ba4784472a38a16ce2c0cdc9 (patch)
treed06b26e9ef598b71937f1c6aab5f10488663556d /src/third_party
parenta74ecb2a746e4d8a8ab78610c07d509788c4d8ad (diff)
downloadmongo-ee4f910322988cb9ba4784472a38a16ce2c0cdc9.tar.gz
SERVER-19607 no recursion in JS -> BSON conversion
Replace functional recursion in javascript object to bson conversion with an explicit stack to minimize the memory cost of processing very deep / cyclical objects. This prevents stack overflows on debug and non-optimized builds on some platforms.
Diffstat (limited to 'src/third_party')
-rw-r--r--src/third_party/mozjs-38/mongo_sources/jscustomallocator.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/third_party/mozjs-38/mongo_sources/jscustomallocator.h b/src/third_party/mozjs-38/mongo_sources/jscustomallocator.h
index bfaec9ee4ff..5efc8d15ca5 100644
--- a/src/third_party/mozjs-38/mongo_sources/jscustomallocator.h
+++ b/src/third_party/mozjs-38/mongo_sources/jscustomallocator.h
@@ -46,6 +46,11 @@ JS_PUBLIC_API(size_t) get_max_bytes();
} // namespace sm
} // namespace mongo
+#ifdef DEBUG
+extern JS_PUBLIC_DATA(uint32_t) OOM_maxAllocations;
+extern JS_PUBLIC_DATA(uint32_t) OOM_counter;
+#endif
+
JS_PUBLIC_API(void*) js_malloc(size_t bytes);
JS_PUBLIC_API(void*) js_calloc(size_t bytes);
JS_PUBLIC_API(void*) js_calloc(size_t nmemb, size_t size);