summaryrefslogtreecommitdiff
path: root/fxjs/fxjs_v8.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs/fxjs_v8.cpp')
-rw-r--r--fxjs/fxjs_v8.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/fxjs/fxjs_v8.cpp b/fxjs/fxjs_v8.cpp
index b0e1a1b260..5f9426b643 100644
--- a/fxjs/fxjs_v8.cpp
+++ b/fxjs/fxjs_v8.cpp
@@ -144,11 +144,11 @@ static v8::Local<v8::ObjectTemplate> GetGlobalObjectTemplate(
}
void* FXJS_ArrayBufferAllocator::Allocate(size_t length) {
- return calloc(1, length);
+ return length <= kMaxAllowedBytes ? calloc(1, length) : nullptr;
}
void* FXJS_ArrayBufferAllocator::AllocateUninitialized(size_t length) {
- return malloc(length);
+ return length < kMaxAllowedBytes ? malloc(length) : nullptr;
}
void FXJS_ArrayBufferAllocator::Free(void* data, size_t length) {