From: drh <> Date: Sat, 27 Jan 2024 12:25:07 +0000 (+0000) Subject: Use an alternative memory allocator for parser stack space that includes X-Git-Tag: version-3.46.0~257 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=48e899a86e9a009fb0f7f32858f65c4adeebb073;p=thirdparty%2Fsqlite.git Use an alternative memory allocator for parser stack space that includes a call to sqlite3FaultSim() to facilitate testing. FossilOrigin-Name: 7c36d560ff4e8e1b3f8fad972ec7f07837e4fa4e6861fafde970ffccfda5a2f1 --- diff --git a/manifest b/manifest index 58d782416d..85a898e370 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Allocate\snew\sparser\sstack\sspace\sfrom\sthe\sheap\sif\sneeded,\seliminating\sthe\npossibility\sof\sa\s"parser\sstack\soverflow"\serror\sas\slong\sas\sheap\smemory\sis\navailable. -D 2024-01-27T11:35:35.516 +C Use\san\salternative\smemory\sallocator\sfor\sparser\sstack\sspace\sthat\sincludes\na\scall\sto\ssqlite3FaultSim()\sto\sfacilitate\stesting. +D 2024-01-27T12:25:07.473 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -727,7 +727,7 @@ F src/os_win.c 6ff43bac175bd9ed79e7c0f96840b139f2f51d01689a638fd05128becf94908a F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a F src/pager.c ff60e98138d2499082ac6230f01ac508aba545315debccfca2fd6042f5f10fcd F src/pager.h 4b1140d691860de0be1347474c51fee07d5420bd7f802d38cbab8ea4ab9f538a -F src/parse.y 7505b34ab81f17c5af10cc2c4c40e94ece3035ef151fe544e21b9a3b0e4e8531 +F src/parse.y bfd6da46fc895cd8237400ff485d04ab0b32e47eb56de20982bb7f53e56c1f42 F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 602acb23c471bb8d557a6f0083cc2be641d6cafcafa19e481eba7ef4c9ca0f00 @@ -2161,9 +2161,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9411337a7b3237366768fc708396da53d67a7a17b6cdc5c6f8932c5ab32217a9 f7290db63cc2568090c14dffc4ea4eadfacb5b94b50a1852ef6eefd9e2e32533 -R 20cc75bdc335ec49c6e2f7e4614d84da -T +closed f7290db63cc2568090c14dffc4ea4eadfacb5b94b50a1852ef6eefd9e2e32533 +P d87a2054774aa6ce54d9ccd78899b638f1eaf4f9a1d847bf22500018049c9f8d +R c777a6ad74adc955afb0be27604d5bbb U drh -Z c2cb0e9c7b04a3911872c4a743c7e226 +Z 010b198501e478def188acd882fee6aa # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ae968423a2..77b98b4841 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d87a2054774aa6ce54d9ccd78899b638f1eaf4f9a1d847bf22500018049c9f8d \ No newline at end of file +7c36d560ff4e8e1b3f8fad972ec7f07837e4fa4e6861fafde970ffccfda5a2f1 \ No newline at end of file diff --git a/src/parse.y b/src/parse.y index 2d5dc8ee38..12621b4348 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