]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Increase the range of integer indexes in the the merge() family of
authordrh <>
Sat, 18 Oct 2025 11:04:03 +0000 (11:04 +0000)
committerdrh <>
Sat, 18 Oct 2025 11:04:03 +0000 (11:04 +0000)
SQL functions.

FossilOrigin-Name: 8d3943890ef3b533df35c4784c2a42c52503a4d9c3dbe67241510d8b70669b48

manifest
manifest.uuid
src/func.c

index 839c03faec254c3bc50bd5e9d3e13f881d85fbaf..e47cd3f7012e035777d63148c8530f69c89d2ac3 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sminor\smemory\sleak\sin\sthe\sCLI\sthat\scan\soccur\sfollowing\san\serror\nin\sthe\s".output"\sdot-command.
-D 2025-10-17T10:06:44.075
+C Increase\sthe\srange\sof\sinteger\sindexes\sin\sthe\sthe\smerge()\sfamily\sof\nSQL\sfunctions.
+D 2025-10-18T11:04:03.155
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -689,7 +689,7 @@ F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42
 F src/expr.c 4d63c8f6d50fe20637de8bdaf57757a0e424e4ac5e2c3313e621d64727a48a1c
 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
 F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f
-F src/func.c c845e41f679a5012612956d76abfc226ad30167a83dd51bf5b21d185db6e8ee4
+F src/func.c 4d945b54a0e931f7454dd9e07d34fd297531355730ec91cb3c06d28a96c7e938
 F src/global.c a19e4b1ca1335f560e9560e590fc13081e21f670643367f99cb9e8f9dc7d615b
 F src/hash.c 73934a7f7ab1cb110614a9388cb516893b0cf5b7b69e4fd1a0780ac4ce166be7
 F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf
@@ -2171,8 +2171,8 @@ F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6dd
 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P b144f875d6bddce62e8f2ad42bfe5dfa6c2434f2ef3edb86847fb4c23aa46814
-R fbb9c34f3eaecc255cfad3a0e53b0966
+P d1044bc0616fd20c63ca3b627ad0a116256870a082a72da26f98fb0f59ca44fd
+R 173a686e3ee4f072a9a9c01363ab9ac0
 U drh
-Z c36f1398fefedf014cfc7845ec7c9d76
+Z 67c06046027313715a3e1ac74b43000b
 # Remove this line to create a well-formed Fossil manifest.
index 1a5aaa6f36bf307370a694adeb74401504f6ea2b..ca991d71b4f10154ea1c35911166b599475481ab 100644 (file)
@@ -1 +1 @@
-d1044bc0616fd20c63ca3b627ad0a116256870a082a72da26f98fb0f59ca44fd
+8d3943890ef3b533df35c4784c2a42c52503a4d9c3dbe67241510d8b70669b48
index 09b4ec1f86b86db5250615d252c30949788afbfc..8dd4673b80c32689463cad4c5073fa90bda494cc 100644 (file)
@@ -2750,8 +2750,8 @@ static void signFunc(
 */
 typedef struct Percentile Percentile;
 struct Percentile {
-  unsigned nAlloc;     /* Number of slots allocated for a[] */
-  unsigned nUsed;      /* Number of slots actually used in a[] */
+  u64 nAlloc;          /* Number of slots allocated for a[] */
+  u64 nUsed;           /* Number of slots actually used in a[] */
   char bSorted;        /* True if a[] is already in sorted order */
   char bKeepSorted;    /* True if advantageous to keep a[] sorted */
   char bPctValid;      /* True if rPct is valid */
@@ -2788,11 +2788,11 @@ static int percentSameValue(double a, double b){
 ** order.  The smallest return value in this case will be 0, and
 ** the largest return value will be p->nUsed.
 */
-static int percentBinarySearch(Percentile *p, double y, int bExact){
-  int iFirst = 0;              /* First element of search range */
-  int iLast = p->nUsed - 1;    /* Last element of search range */
+static i64 percentBinarySearch(Percentile *p, double y, int bExact){
+  i64 iFirst = 0;                   /* First element of search range */
+  i64 iLast = (i64)p->nUsed - 1;    /* Last element of search range */
   while( iLast>=iFirst ){
-    int iMid = (iFirst+iLast)/2;
+    i64 iMid = (iFirst+iLast)/2;
     double x = p->a[iMid];
     if( x<y ){
       iFirst = iMid + 1;
@@ -2895,7 +2895,7 @@ static void percentStep(sqlite3_context *pCtx, int argc, sqlite3_value **argv){
 
   /* Allocate and store the Y */
   if( p->nUsed>=p->nAlloc ){
-    unsigned n = p->nAlloc*2 + 250;
+    u64 n = p->nAlloc*2 + 250;
     double *a = sqlite3_realloc64(p->a, sizeof(double)*n);
     if( a==0 ){
       sqlite3_free(p->a);
@@ -2912,7 +2912,7 @@ static void percentStep(sqlite3_context *pCtx, int argc, sqlite3_value **argv){
   }else if( !p->bSorted || y>=p->a[p->nUsed-1] ){
     p->a[p->nUsed++] = y;
   }else if( p->bKeepSorted ){
-    int i;
+    i64 i;
     i = percentBinarySearch(p, y, 0);
     if( i<(int)p->nUsed ){
       memmove(&p->a[i+1], &p->a[i], (p->nUsed-i)*sizeof(p->a[0]));
@@ -2997,7 +2997,7 @@ static void percentInverse(sqlite3_context *pCtx,int argc,sqlite3_value **argv){
   Percentile *p;
   int eType;
   double y;
-  int i;
+  i64 i;
   assert( argc==2 || argc==1 );
 
   /* Allocate the session context. */