]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix an infinite loop in the MEMSYS5 auxiliary memory allocator that occurs
authordrh <>
Mon, 26 Dec 2022 15:21:42 +0000 (15:21 +0000)
committerdrh <>
Mon, 26 Dec 2022 15:21:42 +0000 (15:21 +0000)
for memory allocations between 1GiB and 2GiB in size.  Error introduced
by check-in [949133231f8f751a].  The problem only affects builds that
include the SQLITE_ENABLE_MEMSYS5 compile-time option.

FossilOrigin-Name: c10d40ca683941be71f3be59b4251cf326a90a24e893169c744ade944dce3ee0

manifest
manifest.uuid
src/mem5.c

index 37452bbc6e8e2df72f3b5af8461320315acc2d04..54eb8a733740f7ac9a912244c3376224bd5748df 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sproblem\sin\sthe\smemdb\svfs\sxLock()\sfunction\sallowing\sclients\sto\supgrade\sto\sEXCLUSIVE\slocks\swhen\sother\sconnections\sare\sholding\sSHARED.
-D 2022-12-05T14:23:06.852
+C Fix\san\sinfinite\sloop\sin\sthe\sMEMSYS5\sauxiliary\smemory\sallocator\sthat\soccurs\nfor\smemory\sallocations\sbetween\s1GiB\sand\s2GiB\sin\ssize.\s\sError\sintroduced\nby\scheck-in\s[949133231f8f751a].\s\sThe\sproblem\sonly\saffects\sbuilds\sthat\ninclude\sthe\sSQLITE_ENABLE_MEMSYS5\scompile-time\soption.
+D 2022-12-26T15:21:42.738
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -606,7 +606,7 @@ F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
 F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
 F src/mem2.c c8bfc9446fd0798bddd495eb5d9dbafa7d4b7287d8c22d50a83ac9daa26d8a75
 F src/mem3.c 30301196cace2a085cbedee1326a49f4b26deff0af68774ca82c1f7c06fda4f6
-F src/mem5.c 5a3dbd8ac8a6501152a4fc1fcae9b0900c2d7eb0589c4ec7456fdde15725a26c
+F src/mem5.c b658f3dd447ad8963d2b4b3f0081aa71f0c827eb99f9cb54675bdf2eea5ad34e
 F src/memdb.c 281e5cea3368b6ada342da37c4cffa88060cb4ee803caf9d83f2422a5ced512d
 F src/memjournal.c c283c6c95d940eb9dc70f1863eef3ee40382dbd35e5a1108026e7817c206e8a0
 F src/msvc.h 3a15918220367a8876be3fa4f2abe423a861491e84b864fb2b7426bf022a28f8
@@ -2055,9 +2055,9 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P e2ae2ea195593f142e4a0c23b7d18381efcaa4114b1de04a97543ac264cd527e
-Q +15f0be8a640e7bfa4130edd4650a745337bd96083b119a1553f9abf9ff066806
-R d07b70ffc1cbebb6ce31a34bad8efad2
+P d18cce37b5b73bb2a4f28eb1b55eb2c3ffe1fc23c921c13170af3d74a549f48e
+Q +8da0f0c38a458c57f979d59b49cf4804ef81fc2eccabde1f166bab24dd1dabea
+R 2c5b08ba1e22dd61038e8865cc6e3975
 U drh
-Z 5db10dbe2408f5c4d9fdadd54b894daf
+Z f8e2b7b61dcdda51d9c96216eeaf6f7d
 # Remove this line to create a well-formed Fossil manifest.
index 2e6a001cc31c73708e2bf7985314489b260aa82a..045fb949b0740fe4e1d6be77abc3c7b00e839819 100644 (file)
@@ -1 +1 @@
-d18cce37b5b73bb2a4f28eb1b55eb2c3ffe1fc23c921c13170af3d74a549f48e
\ No newline at end of file
+c10d40ca683941be71f3be59b4251cf326a90a24e893169c744ade944dce3ee0
\ No newline at end of file
index b61b93e112c8d3d211240fd922033b7df119ff68..336f893c6af38e88f5ae8532f637caf1e71ad16c 100644 (file)
@@ -424,9 +424,13 @@ static int memsys5Roundup(int n){
     if( n<=mem5.szAtom ) return mem5.szAtom;
     return mem5.szAtom*2;
   }
-  if( n>0x40000000 ) return 0;
+  if( n>0x10000000 ){
+    if( n>0x40000000 ) return 0;
+    if( n>0x20000000 ) return 0x40000000;
+    return 0x2000000;
+  }
   for(iFullSz=mem5.szAtom*8; iFullSz<n; iFullSz *= 4);
-  if( (iFullSz/2)>=n ) return iFullSz/2;
+  if( (iFullSz/2)>=(i64)n ) return iFullSz/2;
   return iFullSz;
 }