Copy 25Q2 sqlite 3.44.5 into 3.44.3 directories Copy the 3.44.5 source into the 3.44.3 directory tree. The sqlite version can be verified by examining the content of the source files. This type of change is not required after 25Q4. Manually tested by loading the image and querying the sqlite version. Flag: RELEASE_PACKAGE_LIBSQLITE3 Bug: 430889718 Test: atest * CtsDatabaseTestCases * FrameworksCoreTests:android.database Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:b944515af154aaf989505335f10b6f59f26dc783 Merged-In: If78ac79d4d33447c32ed873cd722987f1d647af7 Change-Id: If78ac79d4d33447c32ed873cd722987f1d647af7
diff --git a/dist/Android.patch b/dist/Android.patch index 65ac33e..a4fe4d2 100644 --- a/dist/Android.patch +++ b/dist/Android.patch
@@ -1,5 +1,5 @@ ---- orig/shell.c 2025-02-19 14:37:16.937833951 -0800 -+++ shell.c 2025-02-19 14:37:16.965833949 -0800 +--- orig/shell.c 2025-12-15 14:05:03.104612303 -0800 ++++ shell.c 2025-12-15 14:05:03.119555727 -0800 @@ -127,6 +127,11 @@ #endif #include <ctype.h> @@ -34,9 +34,9 @@ if( p->openMode==SHELL_OPEN_ZIPFILE ){ char *zSql = sqlite3_mprintf( "CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename); ---- orig/sqlite3.c 2025-02-19 14:37:16.945833951 -0800 -+++ sqlite3.c 2025-02-19 14:37:16.989833949 -0800 -@@ -38035,6 +38035,10 @@ +--- orig/sqlite3.c 2025-12-15 14:05:03.105374142 -0800 ++++ sqlite3.c 2025-12-15 14:05:03.137374406 -0800 +@@ -38043,6 +38043,10 @@ # include <sys/mount.h> #endif @@ -47,7 +47,7 @@ #ifdef HAVE_UTIME # include <utime.h> #endif -@@ -38643,6 +38647,12 @@ +@@ -38651,6 +38655,12 @@ #if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0) osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC); #endif @@ -60,7 +60,7 @@ } return fd; } -@@ -39223,7 +39233,13 @@ +@@ -39231,7 +39241,13 @@ ** and move on. */ static void robust_close(unixFile *pFile, int h, int lineno){ @@ -74,7 +74,7 @@ unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close", pFile ? pFile->zPath : 0, lineno); } -@@ -41763,7 +41779,7 @@ +@@ -41771,7 +41787,7 @@ SimulateIOError( rc=1 ); if( rc!=0 ){ storeLastErrno((unixFile*)id, errno); @@ -83,7 +83,7 @@ } *pSize = buf.st_size; -@@ -41799,7 +41815,7 @@ +@@ -41807,7 +41823,7 @@ struct stat buf; /* Used to hold return values of fstat() */ if( osFstat(pFile->h, &buf) ){ @@ -92,7 +92,7 @@ } nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk; -@@ -42541,7 +42557,7 @@ +@@ -42549,7 +42565,7 @@ ** with the same permissions. */ if( osFstat(pDbFd->h, &sStat) ){ @@ -101,7 +101,7 @@ goto shm_open_err; } -@@ -140718,7 +140734,7 @@ +@@ -140740,7 +140756,7 @@ } if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){ sqlite3SetString(pzErrMsg, db, "unsupported file format"); @@ -110,7 +110,7 @@ goto initone_error_out; } -@@ -188309,7 +188325,9 @@ +@@ -188331,7 +188347,9 @@ ** module with sqlite. */ if( SQLITE_OK==rc @@ -120,7 +120,7 @@ && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1)) && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1)) && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1)) -@@ -188320,6 +188338,20 @@ +@@ -188342,6 +188360,20 @@ rc = sqlite3_create_module_v2( db, "fts3", &fts3Module, (void *)pHash, hashDestroy );
diff --git a/dist/sqlite-autoconf-3440300/Android.patch b/dist/sqlite-autoconf-3440300/Android.patch index e5c0fcf..a4fe4d2 100644 --- a/dist/sqlite-autoconf-3440300/Android.patch +++ b/dist/sqlite-autoconf-3440300/Android.patch
@@ -1,5 +1,5 @@ ---- orig/shell.c 2024-03-25 15:44:27.700300649 -0700 -+++ shell.c 2024-03-25 15:44:27.724300598 -0700 +--- orig/shell.c 2025-12-15 14:05:03.104612303 -0800 ++++ shell.c 2025-12-15 14:05:03.119555727 -0800 @@ -127,6 +127,11 @@ #endif #include <ctype.h> @@ -34,9 +34,9 @@ if( p->openMode==SHELL_OPEN_ZIPFILE ){ char *zSql = sqlite3_mprintf( "CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename); ---- orig/sqlite3.c 2024-03-25 15:44:27.708300632 -0700 -+++ sqlite3.c 2024-03-25 15:44:27.748300548 -0700 -@@ -38035,6 +38035,10 @@ +--- orig/sqlite3.c 2025-12-15 14:05:03.105374142 -0800 ++++ sqlite3.c 2025-12-15 14:05:03.137374406 -0800 +@@ -38043,6 +38043,10 @@ # include <sys/mount.h> #endif @@ -47,7 +47,7 @@ #ifdef HAVE_UTIME # include <utime.h> #endif -@@ -38643,6 +38647,12 @@ +@@ -38651,6 +38655,12 @@ #if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0) osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC); #endif @@ -60,7 +60,7 @@ } return fd; } -@@ -39223,7 +39233,13 @@ +@@ -39231,7 +39241,13 @@ ** and move on. */ static void robust_close(unixFile *pFile, int h, int lineno){ @@ -74,7 +74,7 @@ unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close", pFile ? pFile->zPath : 0, lineno); } -@@ -41763,7 +41779,7 @@ +@@ -41771,7 +41787,7 @@ SimulateIOError( rc=1 ); if( rc!=0 ){ storeLastErrno((unixFile*)id, errno); @@ -83,7 +83,7 @@ } *pSize = buf.st_size; -@@ -41799,7 +41815,7 @@ +@@ -41807,7 +41823,7 @@ struct stat buf; /* Used to hold return values of fstat() */ if( osFstat(pFile->h, &buf) ){ @@ -92,7 +92,7 @@ } nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk; -@@ -42541,7 +42557,7 @@ +@@ -42549,7 +42565,7 @@ ** with the same permissions. */ if( osFstat(pDbFd->h, &sStat) ){ @@ -101,7 +101,7 @@ goto shm_open_err; } -@@ -140715,7 +140731,7 @@ +@@ -140740,7 +140756,7 @@ } if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){ sqlite3SetString(pzErrMsg, db, "unsupported file format"); @@ -110,7 +110,7 @@ goto initone_error_out; } -@@ -188307,7 +188323,9 @@ +@@ -188331,7 +188347,9 @@ ** module with sqlite. */ if( SQLITE_OK==rc @@ -120,7 +120,7 @@ && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1)) && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1)) && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1)) -@@ -188318,6 +188336,20 @@ +@@ -188342,6 +188360,20 @@ rc = sqlite3_create_module_v2( db, "fts3", &fts3Module, (void *)pHash, hashDestroy );
diff --git a/dist/sqlite-autoconf-3440300/METADATA b/dist/sqlite-autoconf-3440300/METADATA index 9765162..cce6062 100644 --- a/dist/sqlite-autoconf-3440300/METADATA +++ b/dist/sqlite-autoconf-3440300/METADATA
@@ -9,10 +9,10 @@ } url { type: ARCHIVE - value: "https://sqlite.org/src/tarball/d68fb8b5/SQLite-d68fb8b5.tar.gz" + value: "https://sqlite.org/src/tarball/sqlite-20250724142641-a881857822.tar.gz" } - version: "3.44.3" - last_upgrade_date { year: 2024 month: 3 day: 25 } + version: "3.44.5" + last_upgrade_date { year: 2025 month: 12 day: 15 } license_type: NOTICE security: {
diff --git a/dist/sqlite-autoconf-3440300/README.version b/dist/sqlite-autoconf-3440300/README.version index a041640..6d4bcf2 100644 --- a/dist/sqlite-autoconf-3440300/README.version +++ b/dist/sqlite-autoconf-3440300/README.version
@@ -1,3 +1,3 @@ -URL: https://sqlite.org/src/tarball/d68fb8b5/SQLite-d68fb8b5.tar.gz -Version: 3.44.3 +URL: https://sqlite.org/src/tarball/sqlite-20250724142641-a881857822.tar.gz +Version: 3.44.5 BugComponent: 24950
diff --git a/dist/sqlite-autoconf-3440300/orig/sqlite3.c b/dist/sqlite-autoconf-3440300/orig/sqlite3.c index a0e8229..000766f 100644 --- a/dist/sqlite-autoconf-3440300/orig/sqlite3.c +++ b/dist/sqlite-autoconf-3440300/orig/sqlite3.c
@@ -1,6 +1,6 @@ /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.44.3. By combining all the individual C code files into this +** version 3.44.5. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -18,7 +18,7 @@ ** separate file. This file contains only code for the core SQLite library. ** ** The content in this amalgamation comes from Fossil check-in -** d68fb8b5dbb8305e00d2dd14d8fe6b3d9f67. +** a88185782279322fea69eebb4bad1fc9c215. */ #define SQLITE_CORE 1 #define SQLITE_AMALGAMATION 1 @@ -459,9 +459,9 @@ ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.44.3" -#define SQLITE_VERSION_NUMBER 3044003 -#define SQLITE_SOURCE_ID "2024-03-24 21:15:01 d68fb8b5dbb8305e00d2dd14d8fe6b3d9f67e2459102ff160d956a6b75ddc18e" +#define SQLITE_VERSION "3.44.5" +#define SQLITE_VERSION_NUMBER 3044005 +#define SQLITE_SOURCE_ID "2025-07-24 14:26:41 a88185782279322fea69eebb4bad1fc9c215dc5a7cb2f3d79fcf19f15e90c6ce" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -14929,6 +14929,14 @@ #define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64) /* +** Macro SMXV(n) return the maximum value that can be held in variable n, +** assuming n is a signed integer type. UMXV(n) is similar for unsigned +** integer types. +*/ +#define SMXV(n) ((((i64)1)<<(sizeof(n)*8-1))-1) +#define UMXV(n) ((((i64)1)<<(sizeof(n)*8))-1) + +/* ** Round up a number to the next larger multiple of 8. This is used ** to force 8-byte alignment on 64-bit architectures. ** @@ -18709,7 +18717,7 @@ ** from source tables rather than from accumulators */ u8 useSortingIdx; /* In direct mode, reference the sorting index rather ** than the source table */ - u16 nSortingColumn; /* Number of columns in the sorting index */ + u32 nSortingColumn; /* Number of columns in the sorting index */ int sortingIdx; /* Cursor number of the sorting index */ int sortingIdxPTab; /* Cursor number of pseudo-table */ int iFirstReg; /* First register in range for aCol[] and aFunc[] */ @@ -18718,8 +18726,8 @@ Table *pTab; /* Source table */ Expr *pCExpr; /* The original expression */ int iTable; /* Cursor number of the source table */ - i16 iColumn; /* Column number within the source table */ - i16 iSorterColumn; /* Column number in the sorting index */ + int iColumn; /* Column number within the source table */ + int iSorterColumn; /* Column number in the sorting index */ } *aCol; int nColumn; /* Number of used entries in aCol[] */ int nAccumulator; /* Number of columns that show through to the output. @@ -79314,7 +79322,7 @@ }else if( loc<0 && pPage->nCell>0 ){ assert( pPage->leaf ); idx = ++pCur->ix; - pCur->curFlags &= ~BTCF_ValidNKey; + pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl); }else{ assert( pPage->leaf ); } @@ -79344,7 +79352,7 @@ */ if( pPage->nOverflow ){ assert( rc==SQLITE_OK ); - pCur->curFlags &= ~(BTCF_ValidNKey); + pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl); rc = balance(pCur); /* Must make sure nOverflow is reset to zero even if the balance() @@ -114711,7 +114719,9 @@ ){ struct AggInfo_col *pCol; int k; + int mxTerm = pParse->db->aLimit[SQLITE_LIMIT_COLUMN]; + assert( mxTerm <= SMXV(i16) ); assert( pAggInfo->iFirstReg==0 ); pCol = pAggInfo->aCol; for(k=0; k<pAggInfo->nColumn; k++, pCol++){ @@ -114729,6 +114739,10 @@ assert( pParse->db->mallocFailed ); return; } + if( k>mxTerm ){ + sqlite3ErrorMsg(pParse, "more than %d aggregate terms", mxTerm); + k = mxTerm; + } pCol = &pAggInfo->aCol[k]; assert( ExprUseYTab(pExpr) ); pCol->pTab = pExpr->y.pTab; @@ -114762,6 +114776,7 @@ if( pExpr->op==TK_COLUMN ){ pExpr->op = TK_AGG_COLUMN; } + assert( k <= SMXV(pExpr->iAgg) ); pExpr->iAgg = (i16)k; } @@ -114845,13 +114860,19 @@ ** function that is already in the pAggInfo structure */ struct AggInfo_func *pItem = pAggInfo->aFunc; + int mxTerm = pParse->db->aLimit[SQLITE_LIMIT_COLUMN]; + assert( mxTerm <= SMXV(i16) ); for(i=0; i<pAggInfo->nFunc; i++, pItem++){ if( pItem->pFExpr==pExpr ) break; if( sqlite3ExprCompare(0, pItem->pFExpr, pExpr, -1)==0 ){ break; } } - if( i>=pAggInfo->nFunc ){ + if( i>mxTerm ){ + sqlite3ErrorMsg(pParse, "more than %d aggregate terms", mxTerm); + i = mxTerm; + assert( i<pAggInfo->nFunc ); + }else if( i>=pAggInfo->nFunc ){ /* pExpr is original. Make a new entry in pAggInfo->aFunc[] */ u8 enc = ENC(pParse->db); @@ -114903,6 +114924,7 @@ */ assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) ); ExprSetVVAProperty(pExpr, EP_NoReduce); + assert( i <= SMXV(pExpr->iAgg) ); pExpr->iAgg = (i16)i; pExpr->pAggInfo = pAggInfo; return WRC_Prune; @@ -129118,7 +129140,7 @@ for(i=0; i<argc; i++){ n += sqlite3_value_bytes(argv[i]); } - n += (argc-1)*nSep; + n += (argc-1)*(i64)nSep; z = sqlite3_malloc64(n+1); if( z==0 ){ sqlite3_result_error_nomem(context); @@ -134769,7 +134791,10 @@ } } #ifndef SQLITE_OMIT_CHECK - if( pDest->pCheck && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) ){ + if( pDest->pCheck + && (db->mDbFlags & DBFLAG_Vacuum)==0 + && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) + ){ return 0; /* Tables have different CHECK constraints. Ticket #2252 */ } #endif @@ -152632,6 +152657,9 @@ } } if( chngRowid==0 && pPk==0 ){ +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + if( isView ) sqlite3VdbeAddOp2(v, OP_Null, 0, regOldRowid); +#endif sqlite3VdbeAddOp2(v, OP_Copy, regOldRowid, regNewRowid); } } @@ -166288,16 +166316,10 @@ for(i=0; i<pIdx->nColumn; i++){ Expr *pExpr; int j = pIdx->aiColumn[i]; - int bMaybeNullRow; if( j==XN_EXPR ){ pExpr = pIdx->aColExpr->a[i].pExpr; - testcase( pTabItem->fg.jointype & JT_LEFT ); - testcase( pTabItem->fg.jointype & JT_RIGHT ); - testcase( pTabItem->fg.jointype & JT_LTORJ ); - bMaybeNullRow = (pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0; }else if( j>=0 && (pTab->aCol[j].colFlags & COLFLAG_VIRTUAL)!=0 ){ pExpr = sqlite3ColumnExpr(pTab, &pTab->aCol[j]); - bMaybeNullRow = 0; }else{ continue; } @@ -166329,7 +166351,7 @@ p->iDataCur = pTabItem->iCursor; p->iIdxCur = iIdxCur; p->iIdxCol = i; - p->bMaybeNullRow = bMaybeNullRow; + p->bMaybeNullRow = (pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0; if( sqlite3IndexAffinityStr(pParse->db, pIdx) ){ p->aff = pIdx->zColAff[i]; } @@ -178561,7 +178583,7 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ #ifndef SQLITE_OMIT_LOOKASIDE void *pStart; - sqlite3_int64 szAlloc = sz*(sqlite3_int64)cnt; + sqlite3_int64 szAlloc; int nBig; /* Number of full-size slots */ int nSm; /* Number smaller LOOKASIDE_SMALL-byte slots */ @@ -178580,7 +178602,9 @@ */ sz = ROUNDDOWN8(sz); /* IMP: R-33038-09382 */ if( sz<=(int)sizeof(LookasideSlot*) ) sz = 0; + if( sz>65528 ) sz = 65528; if( cnt<0 ) cnt = 0; + szAlloc = (i64)sz*(i64)cnt; if( sz==0 || cnt==0 ){ sz = 0; pStart = 0; @@ -178595,10 +178619,10 @@ #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE if( sz>=LOOKASIDE_SMALL*3 ){ nBig = szAlloc/(3*LOOKASIDE_SMALL+sz); - nSm = (szAlloc - sz*nBig)/LOOKASIDE_SMALL; + nSm = (szAlloc - (i64)sz*(i64)nBig)/LOOKASIDE_SMALL; }else if( sz>=LOOKASIDE_SMALL*2 ){ nBig = szAlloc/(LOOKASIDE_SMALL+sz); - nSm = (szAlloc - sz*nBig)/LOOKASIDE_SMALL; + nSm = (szAlloc - (i64)sz*(i64)nBig)/LOOKASIDE_SMALL; }else #endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */ if( sz>0 ){ @@ -247828,7 +247852,7 @@ ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); - sqlite3_result_text(pCtx, "fts5: 2024-03-24 21:15:01 d68fb8b5dbb8305e00d2dd14d8fe6b3d9f67e2459102ff160d956a6b75ddc18e", -1, SQLITE_TRANSIENT); + sqlite3_result_text(pCtx, "fts5: 2025-07-24 14:26:41 a88185782279322fea69eebb4bad1fc9c215dc5a7cb2f3d79fcf19f15e90c6ce", -1, SQLITE_TRANSIENT); } /*
diff --git a/dist/sqlite-autoconf-3440300/orig/sqlite3.h b/dist/sqlite-autoconf-3440300/orig/sqlite3.h index 3f45cf6..6984f36 100644 --- a/dist/sqlite-autoconf-3440300/orig/sqlite3.h +++ b/dist/sqlite-autoconf-3440300/orig/sqlite3.h
@@ -146,9 +146,9 @@ ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.44.3" -#define SQLITE_VERSION_NUMBER 3044003 -#define SQLITE_SOURCE_ID "2024-03-24 21:15:01 d68fb8b5dbb8305e00d2dd14d8fe6b3d9f67e2459102ff160d956a6b75ddc18e" +#define SQLITE_VERSION "3.44.5" +#define SQLITE_VERSION_NUMBER 3044005 +#define SQLITE_SOURCE_ID "2025-07-24 14:26:41 a88185782279322fea69eebb4bad1fc9c215dc5a7cb2f3d79fcf19f15e90c6ce" /* ** CAPI3REF: Run-Time Library Version Numbers
diff --git a/dist/sqlite-autoconf-3440300/sqlite3.c b/dist/sqlite-autoconf-3440300/sqlite3.c index 84b28a1..92a01b9 100644 --- a/dist/sqlite-autoconf-3440300/sqlite3.c +++ b/dist/sqlite-autoconf-3440300/sqlite3.c
@@ -1,6 +1,6 @@ /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.44.3. By combining all the individual C code files into this +** version 3.44.5. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -18,7 +18,7 @@ ** separate file. This file contains only code for the core SQLite library. ** ** The content in this amalgamation comes from Fossil check-in -** d68fb8b5dbb8305e00d2dd14d8fe6b3d9f67. +** a88185782279322fea69eebb4bad1fc9c215. */ #define SQLITE_CORE 1 #define SQLITE_AMALGAMATION 1 @@ -459,9 +459,9 @@ ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.44.3" -#define SQLITE_VERSION_NUMBER 3044003 -#define SQLITE_SOURCE_ID "2024-03-24 21:15:01 d68fb8b5dbb8305e00d2dd14d8fe6b3d9f67e2459102ff160d956a6b75ddc18e" +#define SQLITE_VERSION "3.44.5" +#define SQLITE_VERSION_NUMBER 3044005 +#define SQLITE_SOURCE_ID "2025-07-24 14:26:41 a88185782279322fea69eebb4bad1fc9c215dc5a7cb2f3d79fcf19f15e90c6ce" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -14929,6 +14929,14 @@ #define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64) /* +** Macro SMXV(n) return the maximum value that can be held in variable n, +** assuming n is a signed integer type. UMXV(n) is similar for unsigned +** integer types. +*/ +#define SMXV(n) ((((i64)1)<<(sizeof(n)*8-1))-1) +#define UMXV(n) ((((i64)1)<<(sizeof(n)*8))-1) + +/* ** Round up a number to the next larger multiple of 8. This is used ** to force 8-byte alignment on 64-bit architectures. ** @@ -18709,7 +18717,7 @@ ** from source tables rather than from accumulators */ u8 useSortingIdx; /* In direct mode, reference the sorting index rather ** than the source table */ - u16 nSortingColumn; /* Number of columns in the sorting index */ + u32 nSortingColumn; /* Number of columns in the sorting index */ int sortingIdx; /* Cursor number of the sorting index */ int sortingIdxPTab; /* Cursor number of pseudo-table */ int iFirstReg; /* First register in range for aCol[] and aFunc[] */ @@ -18718,8 +18726,8 @@ Table *pTab; /* Source table */ Expr *pCExpr; /* The original expression */ int iTable; /* Cursor number of the source table */ - i16 iColumn; /* Column number within the source table */ - i16 iSorterColumn; /* Column number in the sorting index */ + int iColumn; /* Column number within the source table */ + int iSorterColumn; /* Column number in the sorting index */ } *aCol; int nColumn; /* Number of used entries in aCol[] */ int nAccumulator; /* Number of columns that show through to the output. @@ -79330,7 +79338,7 @@ }else if( loc<0 && pPage->nCell>0 ){ assert( pPage->leaf ); idx = ++pCur->ix; - pCur->curFlags &= ~BTCF_ValidNKey; + pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl); }else{ assert( pPage->leaf ); } @@ -79360,7 +79368,7 @@ */ if( pPage->nOverflow ){ assert( rc==SQLITE_OK ); - pCur->curFlags &= ~(BTCF_ValidNKey); + pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl); rc = balance(pCur); /* Must make sure nOverflow is reset to zero even if the balance() @@ -114727,7 +114735,9 @@ ){ struct AggInfo_col *pCol; int k; + int mxTerm = pParse->db->aLimit[SQLITE_LIMIT_COLUMN]; + assert( mxTerm <= SMXV(i16) ); assert( pAggInfo->iFirstReg==0 ); pCol = pAggInfo->aCol; for(k=0; k<pAggInfo->nColumn; k++, pCol++){ @@ -114745,6 +114755,10 @@ assert( pParse->db->mallocFailed ); return; } + if( k>mxTerm ){ + sqlite3ErrorMsg(pParse, "more than %d aggregate terms", mxTerm); + k = mxTerm; + } pCol = &pAggInfo->aCol[k]; assert( ExprUseYTab(pExpr) ); pCol->pTab = pExpr->y.pTab; @@ -114778,6 +114792,7 @@ if( pExpr->op==TK_COLUMN ){ pExpr->op = TK_AGG_COLUMN; } + assert( k <= SMXV(pExpr->iAgg) ); pExpr->iAgg = (i16)k; } @@ -114861,13 +114876,19 @@ ** function that is already in the pAggInfo structure */ struct AggInfo_func *pItem = pAggInfo->aFunc; + int mxTerm = pParse->db->aLimit[SQLITE_LIMIT_COLUMN]; + assert( mxTerm <= SMXV(i16) ); for(i=0; i<pAggInfo->nFunc; i++, pItem++){ if( pItem->pFExpr==pExpr ) break; if( sqlite3ExprCompare(0, pItem->pFExpr, pExpr, -1)==0 ){ break; } } - if( i>=pAggInfo->nFunc ){ + if( i>mxTerm ){ + sqlite3ErrorMsg(pParse, "more than %d aggregate terms", mxTerm); + i = mxTerm; + assert( i<pAggInfo->nFunc ); + }else if( i>=pAggInfo->nFunc ){ /* pExpr is original. Make a new entry in pAggInfo->aFunc[] */ u8 enc = ENC(pParse->db); @@ -114919,6 +114940,7 @@ */ assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) ); ExprSetVVAProperty(pExpr, EP_NoReduce); + assert( i <= SMXV(pExpr->iAgg) ); pExpr->iAgg = (i16)i; pExpr->pAggInfo = pAggInfo; return WRC_Prune; @@ -129134,7 +129156,7 @@ for(i=0; i<argc; i++){ n += sqlite3_value_bytes(argv[i]); } - n += (argc-1)*nSep; + n += (argc-1)*(i64)nSep; z = sqlite3_malloc64(n+1); if( z==0 ){ sqlite3_result_error_nomem(context); @@ -134785,7 +134807,10 @@ } } #ifndef SQLITE_OMIT_CHECK - if( pDest->pCheck && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) ){ + if( pDest->pCheck + && (db->mDbFlags & DBFLAG_Vacuum)==0 + && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) + ){ return 0; /* Tables have different CHECK constraints. Ticket #2252 */ } #endif @@ -152648,6 +152673,9 @@ } } if( chngRowid==0 && pPk==0 ){ +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + if( isView ) sqlite3VdbeAddOp2(v, OP_Null, 0, regOldRowid); +#endif sqlite3VdbeAddOp2(v, OP_Copy, regOldRowid, regNewRowid); } } @@ -166304,16 +166332,10 @@ for(i=0; i<pIdx->nColumn; i++){ Expr *pExpr; int j = pIdx->aiColumn[i]; - int bMaybeNullRow; if( j==XN_EXPR ){ pExpr = pIdx->aColExpr->a[i].pExpr; - testcase( pTabItem->fg.jointype & JT_LEFT ); - testcase( pTabItem->fg.jointype & JT_RIGHT ); - testcase( pTabItem->fg.jointype & JT_LTORJ ); - bMaybeNullRow = (pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0; }else if( j>=0 && (pTab->aCol[j].colFlags & COLFLAG_VIRTUAL)!=0 ){ pExpr = sqlite3ColumnExpr(pTab, &pTab->aCol[j]); - bMaybeNullRow = 0; }else{ continue; } @@ -166345,7 +166367,7 @@ p->iDataCur = pTabItem->iCursor; p->iIdxCur = iIdxCur; p->iIdxCol = i; - p->bMaybeNullRow = bMaybeNullRow; + p->bMaybeNullRow = (pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0; if( sqlite3IndexAffinityStr(pParse->db, pIdx) ){ p->aff = pIdx->zColAff[i]; } @@ -178577,7 +178599,7 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ #ifndef SQLITE_OMIT_LOOKASIDE void *pStart; - sqlite3_int64 szAlloc = sz*(sqlite3_int64)cnt; + sqlite3_int64 szAlloc; int nBig; /* Number of full-size slots */ int nSm; /* Number smaller LOOKASIDE_SMALL-byte slots */ @@ -178596,7 +178618,9 @@ */ sz = ROUNDDOWN8(sz); /* IMP: R-33038-09382 */ if( sz<=(int)sizeof(LookasideSlot*) ) sz = 0; + if( sz>65528 ) sz = 65528; if( cnt<0 ) cnt = 0; + szAlloc = (i64)sz*(i64)cnt; if( sz==0 || cnt==0 ){ sz = 0; pStart = 0; @@ -178611,10 +178635,10 @@ #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE if( sz>=LOOKASIDE_SMALL*3 ){ nBig = szAlloc/(3*LOOKASIDE_SMALL+sz); - nSm = (szAlloc - sz*nBig)/LOOKASIDE_SMALL; + nSm = (szAlloc - (i64)sz*(i64)nBig)/LOOKASIDE_SMALL; }else if( sz>=LOOKASIDE_SMALL*2 ){ nBig = szAlloc/(LOOKASIDE_SMALL+sz); - nSm = (szAlloc - sz*nBig)/LOOKASIDE_SMALL; + nSm = (szAlloc - (i64)sz*(i64)nBig)/LOOKASIDE_SMALL; }else #endif /* SQLITE_OMIT_TWOSIZE_LOOKASIDE */ if( sz>0 ){ @@ -247860,7 +247884,7 @@ ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); - sqlite3_result_text(pCtx, "fts5: 2024-03-24 21:15:01 d68fb8b5dbb8305e00d2dd14d8fe6b3d9f67e2459102ff160d956a6b75ddc18e", -1, SQLITE_TRANSIENT); + sqlite3_result_text(pCtx, "fts5: 2025-07-24 14:26:41 a88185782279322fea69eebb4bad1fc9c215dc5a7cb2f3d79fcf19f15e90c6ce", -1, SQLITE_TRANSIENT); } /*
diff --git a/dist/sqlite-autoconf-3440300/sqlite3.h b/dist/sqlite-autoconf-3440300/sqlite3.h index 3f45cf6..6984f36 100644 --- a/dist/sqlite-autoconf-3440300/sqlite3.h +++ b/dist/sqlite-autoconf-3440300/sqlite3.h
@@ -146,9 +146,9 @@ ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.44.3" -#define SQLITE_VERSION_NUMBER 3044003 -#define SQLITE_SOURCE_ID "2024-03-24 21:15:01 d68fb8b5dbb8305e00d2dd14d8fe6b3d9f67e2459102ff160d956a6b75ddc18e" +#define SQLITE_VERSION "3.44.5" +#define SQLITE_VERSION_NUMBER 3044005 +#define SQLITE_SOURCE_ID "2025-07-24 14:26:41 a88185782279322fea69eebb4bad1fc9c215dc5a7cb2f3d79fcf19f15e90c6ce" /* ** CAPI3REF: Run-Time Library Version Numbers