aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2024-01-27 12:25:07 +0000
committerdrh <>2024-01-27 12:25:07 +0000
commit48e899a86e9a009fb0f7f32858f65c4adeebb073 (patch)
tree7b10b29ba0da945a15be11b71fbd47094653d2be /src
parentad2689fe4e894db71f56affac6a843951f6887ff (diff)
downloadsqlite-48e899a86e9a009fb0f7f32858f65c4adeebb073.tar.gz
sqlite-48e899a86e9a009fb0f7f32858f65c4adeebb073.zip
Use an alternative memory allocator for parser stack space that includes
a call to sqlite3FaultSim() to facilitate testing. FossilOrigin-Name: 7c36d560ff4e8e1b3f8fad972ec7f07837e4fa4e6861fafde970ffccfda5a2f1
Diffstat (limited to 'src')
-rw-r--r--src/parse.y10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/parse.y b/src/parse.y
index 2d5dc8ee3..12621b434 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -22,7 +22,7 @@
}
// Function used to enlarge the parser stack, if needed
-%realloc sqlite3_realloc64
+%realloc parserStackRealloc
%free sqlite3_free
// All token codes are small integers with #defines that begin with "TK_"
@@ -551,6 +551,14 @@ cmd ::= select(X). {
}
return pSelect;
}
+
+ /* Memory allocator for parser stack resizing. This is a thin wrapper around
+ ** sqlite3_realloc() that includes a call to sqlite3FaultSim() to facilitate
+ ** testing.
+ */
+ static void *parserStackRealloc(void *pOld, sqlite3_uint64 newSize){
+ return sqlite3FaultSim(700) ? 0 : sqlite3_realloc(pOld, newSize);
+ }
}
%ifndef SQLITE_OMIT_CTE