diff --git a/deps/setup.ps1 b/deps/setup.ps1 index d0414b34..c46d9037 100644 --- a/deps/setup.ps1 +++ b/deps/setup.ps1 @@ -2,7 +2,7 @@ $ErrorActionPreference = "Stop" # SQLite Info -$SQLITEMC_VER = "v1.8.0" +$SQLITEMC_VER = "v1.8.1" $API_URL = "https://api.github.com/repos/utelle/SQLite3MultipleCiphers/releases/tags/" + $SQLITEMC_VER # Paths diff --git a/deps/sqlite3/sqlite3.c b/deps/sqlite3/sqlite3.c index a7e65407..9e2d8759 100644 --- a/deps/sqlite3/sqlite3.c +++ b/deps/sqlite3/sqlite3.c @@ -7,9 +7,31 @@ ** License: MIT */ +/* +** Force some options required for WASM builds +*/ + +#ifdef __WASM__ + +/* Disable User Authentication Extension */ +#ifdef SQLITE_USER_AUTHENTICATION +#undef SQLITE_USER_AUTHENTICATION +#endif +#define SQLITE_USER_AUTHENTICATION 0 + +/* Disable AES hardware support */ +/* Note: this may be changed in the future depending on available support */ +#ifdef SQLITE3MC_OMIT_AES_HARDWARE_SUPPORT +#undef SQLITE3MC_OMIT_AES_HARDWARE_SUPPORT +#endif +#define SQLITE3MC_OMIT_AES_HARDWARE_SUPPORT 1 + +#endif + /* ** Enable SQLite debug assertions if requested */ + #ifndef SQLITE_DEBUG #if defined(SQLITE_ENABLE_DEBUG) && (SQLITE_ENABLE_DEBUG == 1) #define SQLITE_DEBUG 1 @@ -111,7 +133,7 @@ extern SQLITE_API LPWSTR sqlite3_win32_utf8_to_unicode(const char*); /*** Begin of #include "sqlite3patched.c" ***/ /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.44.1. By combining all the individual C code files into this +** version 3.44.2. 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 @@ -129,7 +151,7 @@ extern SQLITE_API LPWSTR sqlite3_win32_utf8_to_unicode(const char*); ** separate file. This file contains only code for the core SQLite library. ** ** The content in this amalgamation comes from Fossil check-in -** d295f48e8f367b066b881780c98bdf980a1d. +** ebead0e7230cd33bcec9f95d2183069565b9. */ #define SQLITE_CORE 1 #define SQLITE_AMALGAMATION 1 @@ -570,9 +592,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.44.1" -#define SQLITE_VERSION_NUMBER 3044001 -#define SQLITE_SOURCE_ID "2023-11-22 14:18:12 d295f48e8f367b066b881780c98bdf980a1d550397d5ba0b0e49842c95b3e8b4" +#define SQLITE_VERSION "3.44.2" +#define SQLITE_VERSION_NUMBER 3044002 +#define SQLITE_SOURCE_ID "2023-11-24 11:41:44 ebead0e7230cd33bcec9f95d2183069565b9e709bf745c9b5db65cc0cbf92c0f" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -84316,10 +84338,11 @@ static int growOpArray(Vdbe *v, int nOp){ ** sqlite3CantopenError(lineno) */ static void test_addop_breakpoint(int pc, Op *pOp){ - static int n = 0; + static u64 n = 0; (void)pc; (void)pOp; n++; + if( n==LARGEST_UINT64 ) abort(); /* so that n is used, preventing a warning */ } #endif @@ -92463,11 +92486,12 @@ SQLITE_API int sqlite3_found_count = 0; ** sqlite3CantopenError(lineno) */ static void test_trace_breakpoint(int pc, Op *pOp, Vdbe *v){ - static int n = 0; + static u64 n = 0; (void)pc; (void)pOp; (void)v; n++; + if( n==LARGEST_UINT64 ) abort(); /* So that n is used, preventing a warning */ } #endif @@ -143750,7 +143774,8 @@ SQLITE_PRIVATE void sqlite3SubqueryColumnTypes( NameContext sNC; assert( pSelect!=0 ); - assert( (pSelect->selFlags & SF_Resolved)!=0 ); + testcase( (pSelect->selFlags & SF_Resolved)==0 ); + assert( (pSelect->selFlags & SF_Resolved)!=0 || IN_RENAME_OBJECT ); assert( pTab->nCol==pSelect->pEList->nExpr || pParse->nErr>0 ); assert( aff==SQLITE_AFF_NONE || aff==SQLITE_AFF_BLOB ); if( db->mallocFailed || IN_RENAME_OBJECT ) return; @@ -241652,18 +241677,24 @@ static void fts5DoSecureDelete( iOff = iStart; - /* Set variable bLastInDoclist to true if this entry happens to be - ** the last rowid in the doclist for its term. */ + /* If the position-list for the entry being removed flows over past + ** the end of this page, delete the portion of the position-list on the + ** next page and beyond. + ** + ** Set variable bLastInDoclist to true if this entry happens + ** to be the last rowid in the doclist for its term. */ + if( iNextOff>=iPgIdx ){ + int pgno = pSeg->iLeafPgno+1; + fts5SecureDeleteOverflow(p, pSeg->pSeg, pgno, &bLastInDoclist); + iNextOff = iPgIdx; + } + if( pSeg->bDel==0 ){ - if( iNextOff>=iPgIdx ){ - int pgno = pSeg->iLeafPgno+1; - fts5SecureDeleteOverflow(p, pSeg->pSeg, pgno, &bLastInDoclist); - iNextOff = iPgIdx; - }else{ + if( iNextOff!=iPgIdx ){ /* Loop through the page-footer. If iNextOff (offset of the ** entry following the one we are removing) is equal to the ** offset of a key on this page, then the entry is the last - ** in its doclist. */ + ** in its doclist. */ int iKeyOff = 0; for(iIdx=0; iIdxpPager); void* aData = 0; - if (pFile->pMethods == &mcIoMethodsGlobal) + if (pFile->pMethods == &mcIoMethodsGlobal1 || + pFile->pMethods == &mcIoMethodsGlobal2 || + pFile->pMethods == &mcIoMethodsGlobal3) { sqlite3mc_file* mcFile = (sqlite3mc_file*) pFile; Codec* codec = mcFile->codec; @@ -301810,9 +301896,18 @@ static int mcVfsOpen(sqlite3_vfs* pVfs, const char* zName, sqlite3_file* pFile, if (rc == SQLITE_OK) { /* - ** Real open succeeded, initialize methods, register main database files + ** Real open succeeded + ** Initialize methods (use same version number as underlying implementation + ** Register main database files */ - pFile->pMethods = &mcIoMethodsGlobal; + int ioMethodsVersion = mcFile->pFile->pMethods->iVersion; + if (ioMethodsVersion < IOMETHODS_VERSION_MIN || + ioMethodsVersion > IOMETHODS_VERSION_MAX) + { + /* If version out of range, use highest known version */ + ioMethodsVersion = IOMETHODS_VERSION_MAX; + } + pFile->pMethods = mcIoMethodsGlobal[ioMethodsVersion]; if (flags & SQLITE_OPEN_MAIN_DB) { mcMainListAdd(mcFile); @@ -302598,7 +302693,10 @@ static int mcIoFileControl(sqlite3_file* pFile, int op, void* pArg) static int mcIoSectorSize(sqlite3_file* pFile) { - return REALFILE(pFile)->pMethods->xSectorSize(REALFILE(pFile)); + if (REALFILE(pFile)->pMethods->xSectorSize) + return REALFILE(pFile)->pMethods->xSectorSize(REALFILE(pFile)); + else + return SQLITE_DEFAULT_SECTOR_SIZE; } static int mcIoDeviceCharacteristics(sqlite3_file* pFile) diff --git a/deps/sqlite3/sqlite3.h b/deps/sqlite3/sqlite3.h index 9c2c2a8b..7ea531bc 100644 --- a/deps/sqlite3/sqlite3.h +++ b/deps/sqlite3/sqlite3.h @@ -31,9 +31,9 @@ #define SQLITE3MC_VERSION_MAJOR 1 #define SQLITE3MC_VERSION_MINOR 8 -#define SQLITE3MC_VERSION_RELEASE 0 +#define SQLITE3MC_VERSION_RELEASE 1 #define SQLITE3MC_VERSION_SUBRELEASE 0 -#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.8.0" +#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.8.1" #endif /* SQLITE3MC_VERSION_H_ */ /*** End of #include "sqlite3mc_version.h" ***/ @@ -192,9 +192,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.44.1" -#define SQLITE_VERSION_NUMBER 3044001 -#define SQLITE_SOURCE_ID "2023-11-22 14:18:12 d295f48e8f367b066b881780c98bdf980a1d550397d5ba0b0e49842c95b3e8b4" +#define SQLITE_VERSION "3.44.2" +#define SQLITE_VERSION_NUMBER 3044002 +#define SQLITE_SOURCE_ID "2023-11-24 11:41:44 ebead0e7230cd33bcec9f95d2183069565b9e709bf745c9b5db65cc0cbf92c0f" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -13389,7 +13389,7 @@ extern "C" { ** If the SQLITE_USER table is not present in the database file, then ** this interface is a harmless no-op returnning SQLITE_OK. */ -int sqlite3_user_authenticate( +SQLITE_API int sqlite3_user_authenticate( sqlite3 *db, /* The database connection */ const char *zUsername, /* Username */ const char *aPW, /* Password or credentials */ @@ -13406,7 +13406,7 @@ int sqlite3_user_authenticate( ** for any ATTACH-ed databases. Any call to sqlite3_user_add() by a ** non-admin user results in an error. */ -int sqlite3_user_add( +SQLITE_API int sqlite3_user_add( sqlite3 *db, /* Database connection */ const char *zUsername, /* Username to be added */ const char *aPW, /* Password or credentials */ @@ -13421,7 +13421,7 @@ int sqlite3_user_add( ** credentials or admin privilege setting. No user may change their own ** admin privilege setting. */ -int sqlite3_user_change( +SQLITE_API int sqlite3_user_change( sqlite3 *db, /* Database connection */ const char *zUsername, /* Username to change */ const char *aPW, /* New password or credentials */ @@ -13436,7 +13436,7 @@ int sqlite3_user_change( ** the database cannot be converted into a no-authentication-required ** database. */ -int sqlite3_user_delete( +SQLITE_API int sqlite3_user_delete( sqlite3 *db, /* Database connection */ const char *zUsername /* Username to remove */ ); diff --git a/docs/compilation.md b/docs/compilation.md index b1f56bec..bccdd7d7 100644 --- a/docs/compilation.md +++ b/docs/compilation.md @@ -43,7 +43,7 @@ If you're using a SQLite3 encryption extension that is a drop-in replacement for # Bundled configuration -By default, this distribution currently uses SQLite3 **version 3.44.1** with the following [compilation options](https://www.sqlite.org/compile.html): +By default, this distribution currently uses SQLite3 **version 3.44.2** with the following [compilation options](https://www.sqlite.org/compile.html): ``` HAVE_INT16_T=1