aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/bindings/sqlite/JSSQLStatement.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bun.js/bindings/sqlite/JSSQLStatement.cpp b/src/bun.js/bindings/sqlite/JSSQLStatement.cpp
index 7f740ae66..7f90360f6 100644
--- a/src/bun.js/bindings/sqlite/JSSQLStatement.cpp
+++ b/src/bun.js/bindings/sqlite/JSSQLStatement.cpp
@@ -1000,7 +1000,10 @@ static void initializeColumnNames(JSC::JSGlobalObject* lexicalGlobalObject, JSSQ
if (count == 0)
return;
JSC::ObjectInitializationScope initializationScope(vm);
- JSC::JSObject* object = JSC::constructEmptyObject(lexicalGlobalObject, lexicalGlobalObject->objectPrototype(), count);
+
+ // 64 is the maximum we can preallocate here
+ // see https://github.com/oven-sh/bun/issues/987
+ JSC::JSObject* object = JSC::constructEmptyObject(lexicalGlobalObject, lexicalGlobalObject->objectPrototype(), std::min(count, 64));
for (int i = 0; i < count; i++) {
const char* name = sqlite3_column_name(stmt, i);