better-sqlite3-multiple-ciphers 12.9.0 → 12.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,10 +17,10 @@ The fastest and simplest library for SQLite in Node.js. This particular fork sup
17
17
  ## Current versions
18
18
 
19
19
  - ### Stable
20
- - **better-sqlite3-multiple-ciphers** - [`12.9.0`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v12.9.0)
21
- - **better-sqlite3** - [`12.9.0`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v12.9.0)
22
- - **SQLite** - [`3.53.0`](https://www.sqlite.org/releaselog/3_53_0.html)
23
- - **SQLite3 Multiple Ciphers** - [`2.3.3`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v2.3.3)
20
+ - **better-sqlite3-multiple-ciphers** - [`12.10.0`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v12.10.0)
21
+ - **better-sqlite3** - [`12.10.0`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v12.10.0)
22
+ - **SQLite** - [`3.53.1`](https://www.sqlite.org/releaselog/3_53_1.html)
23
+ - **SQLite3 Multiple Ciphers** - [`2.3.4`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v2.3.4)
24
24
 
25
25
  - ### Beta
26
26
  - **better-sqlite3-multiple-ciphers** - [`11.0.0-beta.0`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v11.0.0-beta.0)
package/deps/defines.gypi CHANGED
@@ -1,42 +1,43 @@
1
- # THIS FILE IS AUTOMATICALLY GENERATED BY deps/download.sh (DO NOT EDIT)
2
-
3
- {
4
- 'defines': [
5
- 'HAVE_INT16_T=1',
6
- 'HAVE_INT32_T=1',
7
- 'HAVE_INT8_T=1',
8
- 'HAVE_STDINT_H=1',
9
- 'HAVE_UINT16_T=1',
10
- 'HAVE_UINT32_T=1',
11
- 'HAVE_UINT8_T=1',
12
- 'HAVE_USLEEP=1',
13
- 'SQLITE_DEFAULT_CACHE_SIZE=-16000',
14
- 'SQLITE_DEFAULT_FOREIGN_KEYS=1',
15
- 'SQLITE_DEFAULT_MEMSTATUS=0',
16
- 'SQLITE_DEFAULT_WAL_SYNCHRONOUS=1',
17
- 'SQLITE_DQS=0',
18
- 'SQLITE_ENABLE_COLUMN_METADATA',
19
- 'SQLITE_ENABLE_DBSTAT_VTAB',
20
- 'SQLITE_ENABLE_DESERIALIZE',
21
- 'SQLITE_ENABLE_FTS3',
22
- 'SQLITE_ENABLE_FTS3_PARENTHESIS',
23
- 'SQLITE_ENABLE_FTS4',
24
- 'SQLITE_ENABLE_FTS5',
25
- 'SQLITE_ENABLE_GEOPOLY',
26
- 'SQLITE_ENABLE_JSON1',
27
- 'SQLITE_ENABLE_MATH_FUNCTIONS',
28
- 'SQLITE_ENABLE_RTREE',
29
- 'SQLITE_ENABLE_STAT4',
30
- 'SQLITE_ENABLE_UPDATE_DELETE_LIMIT',
31
- 'SQLITE_LIKE_DOESNT_MATCH_BLOBS',
32
- 'SQLITE_OMIT_DEPRECATED',
33
- 'SQLITE_OMIT_PROGRESS_CALLBACK',
34
- 'SQLITE_OMIT_SHARED_CACHE',
35
- 'SQLITE_OMIT_TCL_VARIABLE',
36
- 'SQLITE_SOUNDEX',
37
- 'SQLITE_THREADSAFE=2',
38
- 'SQLITE_TRACE_SIZE_LIMIT=32',
39
- 'SQLITE_USER_AUTHENTICATION=0',
40
- 'SQLITE_USE_URI=0',
41
- ],
42
- }
1
+ # THIS FILE IS AUTOMATICALLY GENERATED BY deps/download.sh (DO NOT EDIT)
2
+
3
+ {
4
+ 'defines': [
5
+ 'HAVE_INT16_T=1',
6
+ 'HAVE_INT32_T=1',
7
+ 'HAVE_INT8_T=1',
8
+ 'HAVE_STDINT_H=1',
9
+ 'HAVE_UINT16_T=1',
10
+ 'HAVE_UINT32_T=1',
11
+ 'HAVE_UINT8_T=1',
12
+ 'HAVE_USLEEP=1',
13
+ 'SQLITE_DEFAULT_CACHE_SIZE=-16000',
14
+ 'SQLITE_DEFAULT_FOREIGN_KEYS=1',
15
+ 'SQLITE_DEFAULT_MEMSTATUS=0',
16
+ 'SQLITE_DEFAULT_WAL_SYNCHRONOUS=1',
17
+ 'SQLITE_DQS=0',
18
+ 'SQLITE_ENABLE_COLUMN_METADATA',
19
+ 'SQLITE_ENABLE_DBSTAT_VTAB',
20
+ 'SQLITE_ENABLE_DESERIALIZE',
21
+ 'SQLITE_ENABLE_FTS3',
22
+ 'SQLITE_ENABLE_FTS3_PARENTHESIS',
23
+ 'SQLITE_ENABLE_FTS4',
24
+ 'SQLITE_ENABLE_FTS5',
25
+ 'SQLITE_ENABLE_GEOPOLY',
26
+ 'SQLITE_ENABLE_JSON1',
27
+ 'SQLITE_ENABLE_MATH_FUNCTIONS',
28
+ 'SQLITE_ENABLE_PERCENTILE',
29
+ 'SQLITE_ENABLE_RTREE',
30
+ 'SQLITE_ENABLE_STAT4',
31
+ 'SQLITE_ENABLE_UPDATE_DELETE_LIMIT',
32
+ 'SQLITE_LIKE_DOESNT_MATCH_BLOBS',
33
+ 'SQLITE_OMIT_DEPRECATED',
34
+ 'SQLITE_OMIT_PROGRESS_CALLBACK',
35
+ 'SQLITE_OMIT_SHARED_CACHE',
36
+ 'SQLITE_OMIT_TCL_VARIABLE',
37
+ 'SQLITE_SOUNDEX',
38
+ 'SQLITE_THREADSAFE=2',
39
+ 'SQLITE_TRACE_SIZE_LIMIT=32',
40
+ 'SQLITE_USER_AUTHENTICATION=0',
41
+ 'SQLITE_USE_URI=0',
42
+ ],
43
+ }
@@ -123,7 +123,7 @@ SQLITE_API LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
123
123
  /*** Begin of #include "sqlite3patched.c" ***/
124
124
  /******************************************************************************
125
125
  ** This file is an amalgamation of many separate C source files from SQLite
126
- ** version 3.53.0. By combining all the individual C code files into this
126
+ ** version 3.53.1. By combining all the individual C code files into this
127
127
  ** single large file, the entire code can be compiled as a single translation
128
128
  ** unit. This allows many compilers to do optimizations that would not be
129
129
  ** possible if the files were compiled separately. Performance improvements
@@ -141,7 +141,7 @@ SQLITE_API LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
141
141
  ** separate file. This file contains only code for the core SQLite library.
142
142
  **
143
143
  ** The content in this amalgamation comes from Fossil check-in
144
- ** 4525003a53a7fc63ca75c59b22c79608659c with changes in files:
144
+ ** c88b22011a54b4f6fbd149e9f8e4de77658c with changes in files:
145
145
  **
146
146
  **
147
147
  */
@@ -591,12 +591,12 @@ extern "C" {
591
591
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
592
592
  ** [sqlite_version()] and [sqlite_source_id()].
593
593
  */
594
- #define SQLITE_VERSION "3.53.0"
595
- #define SQLITE_VERSION_NUMBER 3053000
596
- #define SQLITE_SOURCE_ID "2026-04-09 11:41:38 4525003a53a7fc63ca75c59b22c79608659ca12f0131f52c18637f829977f20b"
597
- #define SQLITE_SCM_BRANCH "trunk"
598
- #define SQLITE_SCM_TAGS "release major-release version-3.53.0"
599
- #define SQLITE_SCM_DATETIME "2026-04-09T11:41:38.498Z"
594
+ #define SQLITE_VERSION "3.53.1"
595
+ #define SQLITE_VERSION_NUMBER 3053001
596
+ #define SQLITE_SOURCE_ID "2026-05-05 10:34:17 c88b22011a54b4f6fbd149e9f8e4de77658ce58143a1af0e3785e4e6475127e9"
597
+ #define SQLITE_SCM_BRANCH "branch-3.53"
598
+ #define SQLITE_SCM_TAGS "release version-3.53.1"
599
+ #define SQLITE_SCM_DATETIME "2026-05-05T10:34:17.344Z"
600
600
 
601
601
  /*
602
602
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -32657,7 +32657,7 @@ static char *printfTempBuf(sqlite3_str *pAccum, sqlite3_int64 n){
32657
32657
  sqlite3StrAccumSetError(pAccum, SQLITE_TOOBIG);
32658
32658
  return 0;
32659
32659
  }
32660
- z = sqlite3DbMallocRaw(pAccum->db, n);
32660
+ z = sqlite3_malloc(n);
32661
32661
  if( z==0 ){
32662
32662
  sqlite3StrAccumSetError(pAccum, SQLITE_NOMEM);
32663
32663
  }
@@ -33115,11 +33115,27 @@ SQLITE_API void sqlite3_str_vappendf(
33115
33115
 
33116
33116
  szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+10;
33117
33117
  if( cThousand && e2>0 ) szBufNeeded += (e2+2)/3;
33118
- if( sqlite3StrAccumEnlargeIfNeeded(pAccum, szBufNeeded) ){
33119
- width = length = 0;
33120
- break;
33118
+ if( szBufNeeded + pAccum->nChar >= pAccum->nAlloc ){
33119
+ if( pAccum->mxAlloc==0 && pAccum->accError==0 ){
33120
+ /* Unable to allocate space in pAccum, perhaps because it
33121
+ ** is coming from sqlite3_snprintf() or similar. We'll have
33122
+ ** to render into temporary space and the memcpy() it over. */
33123
+ bufpt = sqlite3_malloc(szBufNeeded);
33124
+ if( bufpt==0 ){
33125
+ sqlite3StrAccumSetError(pAccum, SQLITE_NOMEM);
33126
+ return;
33127
+ }
33128
+ zExtra = bufpt;
33129
+ }else if( sqlite3StrAccumEnlarge(pAccum, szBufNeeded)<szBufNeeded ){
33130
+ width = length = 0;
33131
+ break;
33132
+ }else{
33133
+ bufpt = pAccum->zText + pAccum->nChar;
33134
+ }
33135
+ }else{
33136
+ bufpt = pAccum->zText + pAccum->nChar;
33121
33137
  }
33122
- bufpt = zOut = pAccum->zText + pAccum->nChar;
33138
+ zOut = bufpt;
33123
33139
 
33124
33140
  flag_dp = (precision>0 ?1:0) | flag_alternateform | flag_altform2;
33125
33141
  /* The sign in front of the number */
@@ -33220,14 +33236,22 @@ SQLITE_API void sqlite3_str_vappendf(
33220
33236
  }
33221
33237
  length = width;
33222
33238
  }
33223
- pAccum->nChar += length;
33224
- zOut[length] = 0;
33225
33239
 
33226
- /* Floating point conversions render directly into the output
33227
- ** buffer. Hence, don't just break out of the switch(). Bypass the
33228
- ** output buffer writing that occurs after the switch() by continuing
33229
- ** to the next character in the format string. */
33230
- continue;
33240
+ if( zExtra==0 ){
33241
+ /* The result is being rendered directory into pAccum. This
33242
+ ** is the command and fast case */
33243
+ pAccum->nChar += length;
33244
+ zOut[length] = 0;
33245
+ continue;
33246
+ }else{
33247
+ /* We were unable to render directly into pAccum because we
33248
+ ** couldn't allocate sufficient memory. We need to memcpy()
33249
+ ** the rendering (or some prefix thereof) into the output
33250
+ ** buffer. */
33251
+ bufpt[0] = 0;
33252
+ bufpt = zExtra;
33253
+ break;
33254
+ }
33231
33255
  }
33232
33256
  case etSIZE:
33233
33257
  if( !bArgList ){
@@ -33274,7 +33298,7 @@ SQLITE_API void sqlite3_str_vappendf(
33274
33298
  if( sqlite3StrAccumEnlargeIfNeeded(pAccum, nCopyBytes) ){
33275
33299
  break;
33276
33300
  }
33277
- sqlite3_str_append(pAccum,
33301
+ sqlite3_str_append(pAccum,
33278
33302
  &pAccum->zText[pAccum->nChar-nCopyBytes], nCopyBytes);
33279
33303
  precision -= nPrior;
33280
33304
  nPrior *= 2;
@@ -33790,7 +33814,7 @@ SQLITE_API void sqlite3_str_reset(StrAccum *p){
33790
33814
  ** of its content, all in one call.
33791
33815
  */
33792
33816
  SQLITE_API void sqlite3_str_free(sqlite3_str *p){
33793
- if( p ){
33817
+ if( p!=0 && p!=&sqlite3OomStr ){
33794
33818
  sqlite3_str_reset(p);
33795
33819
  sqlite3_free(p);
33796
33820
  }
@@ -36936,15 +36960,20 @@ SQLITE_PRIVATE u8 sqlite3StrIHash(const char *z){
36936
36960
  return h;
36937
36961
  }
36938
36962
 
36963
+ #if !defined(SQLITE_DISABLE_INTRINSIC) \
36964
+ && (defined(__GNUC__) || defined(__clang__)) \
36965
+ && (defined(__x86_64__) || defined(__aarch64__) || \
36966
+ (defined(__riscv) && defined(__riscv_xlen) && (__riscv_xlen>32)))
36967
+ #define SQLITE_USE_UINT128
36968
+ #endif
36969
+
36939
36970
  /*
36940
36971
  ** Two inputs are multiplied to get a 128-bit result. Write the
36941
36972
  ** lower 64-bits of the result into *pLo, and return the high-order
36942
36973
  ** 64 bits.
36943
36974
  */
36944
36975
  static u64 sqlite3Multiply128(u64 a, u64 b, u64 *pLo){
36945
- #if (defined(__GNUC__) || defined(__clang__)) \
36946
- && (defined(__x86_64__) || defined(__aarch64__) || defined(__riscv)) \
36947
- && !defined(SQLITE_DISABLE_INTRINSIC)
36976
+ #if defined(SQLITE_USE_UINT128)
36948
36977
  __uint128_t r = (__uint128_t)a * b;
36949
36978
  *pLo = (u64)r;
36950
36979
  return (u64)(r>>64);
@@ -36978,9 +37007,7 @@ static u64 sqlite3Multiply128(u64 a, u64 b, u64 *pLo){
36978
37007
  ** The lower 64 bits of A*B are discarded.
36979
37008
  */
36980
37009
  static u64 sqlite3Multiply160(u64 a, u32 aLo, u64 b, u32 *pLo){
36981
- #if (defined(__GNUC__) || defined(__clang__)) \
36982
- && (defined(__x86_64__) || defined(__aarch64__) || defined(__riscv)) \
36983
- && !defined(SQLITE_DISABLE_INTRINSIC)
37010
+ #if defined(SQLITE_USE_UINT128)
36984
37011
  __uint128_t r = (__uint128_t)a * b;
36985
37012
  r += ((__uint128_t)aLo * b) >> 32;
36986
37013
  *pLo = (r>>32)&0xffffffff;
@@ -37018,6 +37045,8 @@ static u64 sqlite3Multiply160(u64 a, u32 aLo, u64 b, u32 *pLo){
37018
37045
  #endif
37019
37046
  }
37020
37047
 
37048
+ #undef SQLITE_USE_UINT128
37049
+
37021
37050
  /*
37022
37051
  ** Return a u64 with the N-th bit set.
37023
37052
  */
@@ -56256,10 +56285,10 @@ SQLITE_API int sqlite3_deserialize(
56256
56285
  if( rc ) goto end_deserialize;
56257
56286
  db->init.iDb = (u8)iDb;
56258
56287
  db->init.reopenMemdb = 1;
56259
- rc = sqlite3_step(pStmt);
56288
+ sqlite3_step(pStmt);
56260
56289
  db->init.reopenMemdb = 0;
56261
- if( rc!=SQLITE_DONE ){
56262
- rc = SQLITE_ERROR;
56290
+ rc = sqlite3_finalize(pStmt);
56291
+ if( rc!=SQLITE_OK ){
56263
56292
  goto end_deserialize;
56264
56293
  }
56265
56294
  p = memdbFromDbSchema(db, zSchema);
@@ -56280,7 +56309,6 @@ SQLITE_API int sqlite3_deserialize(
56280
56309
  }
56281
56310
 
56282
56311
  end_deserialize:
56283
- sqlite3_finalize(pStmt);
56284
56312
  if( pData && (mFlags & SQLITE_DESERIALIZE_FREEONCLOSE)!=0 ){
56285
56313
  sqlite3_free(pData);
56286
56314
  }
@@ -123277,7 +123305,9 @@ SQLITE_PRIVATE void sqlite3AlterDropConstraint(
123277
123305
  if( !pTab ) return;
123278
123306
 
123279
123307
  if( pCons ){
123280
- zArg = sqlite3MPrintf(db, "%.*Q", pCons->n, pCons->z);
123308
+ char *z = sqlite3NameFromToken(db, pCons);
123309
+ zArg = sqlite3MPrintf(db, "%Q", z);
123310
+ sqlite3DbFree(db, z);
123281
123311
  }else{
123282
123312
  int iCol;
123283
123313
  if( alterFindCol(pParse, pTab, pCol, &iCol) ) return;
@@ -125659,6 +125689,16 @@ static void attachFunc(
125659
125689
  ** from sqlite3_deserialize() to close database db->init.iDb and
125660
125690
  ** reopen it as a MemDB */
125661
125691
  Btree *pNewBt = 0;
125692
+
125693
+ pNew = &db->aDb[db->init.iDb];
125694
+ assert( pNew->pBt!=0 );
125695
+ if( sqlite3BtreeTxnState(pNew->pBt)!=SQLITE_TXN_NONE
125696
+ || sqlite3BtreeIsInBackup(pNew->pBt)
125697
+ ){
125698
+ rc = SQLITE_BUSY;
125699
+ goto attach_error;
125700
+ }
125701
+
125662
125702
  pVfs = sqlite3_vfs_find("memdb");
125663
125703
  if( pVfs==0 ) return;
125664
125704
  rc = sqlite3BtreeOpen(pVfs, "x\0", db, &pNewBt, 0, SQLITE_OPEN_MAIN_DB);
@@ -125668,8 +125708,7 @@ static void attachFunc(
125668
125708
  /* Both the Btree and the new Schema were allocated successfully.
125669
125709
  ** Close the old db and update the aDb[] slot with the new memdb
125670
125710
  ** values. */
125671
- pNew = &db->aDb[db->init.iDb];
125672
- if( ALWAYS(pNew->pBt) ) sqlite3BtreeClose(pNew->pBt);
125711
+ sqlite3BtreeClose(pNew->pBt);
125673
125712
  pNew->pBt = pNewBt;
125674
125713
  pNew->pSchema = pNewSchema;
125675
125714
  }else{
@@ -156217,6 +156256,7 @@ static SQLITE_NOINLINE void existsToJoin(
156217
156256
  && !ExprHasProperty(pWhere, EP_OuterON|EP_InnerON)
156218
156257
  && ALWAYS(p->pSrc!=0)
156219
156258
  && p->pSrc->nSrc<BMS
156259
+ && (p->pLimit==0 || p->pLimit->pRight==0)
156220
156260
  ){
156221
156261
  if( pWhere->op==TK_AND ){
156222
156262
  Expr *pRight = pWhere->pRight;
@@ -156264,7 +156304,6 @@ static SQLITE_NOINLINE void existsToJoin(
156264
156304
  sqlite3TreeViewSelect(0, p, 0);
156265
156305
  }
156266
156306
  #endif
156267
- existsToJoin(pParse, p, pSubWhere);
156268
156307
  }
156269
156308
  }
156270
156309
  }
@@ -166115,7 +166154,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
166115
166154
  ** by this loop in the a[0] slot and all notReady tables in a[1..] slots.
166116
166155
  ** This becomes the SrcList in the recursive call to sqlite3WhereBegin().
166117
166156
  */
166118
- if( pWInfo->nLevel>1 ){
166157
+ if( pWInfo->nLevel>1 || pTabItem->fg.fromExists ){
166119
166158
  int nNotReady; /* The number of notReady tables */
166120
166159
  SrcItem *origSrc; /* Original list of tables */
166121
166160
  nNotReady = pWInfo->nLevel - iLevel - 1;
@@ -166128,6 +166167,13 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
166128
166167
  for(k=1; k<=nNotReady; k++){
166129
166168
  memcpy(&pOrTab->a[k], &origSrc[pLevel[k].iFrom], sizeof(pOrTab->a[k]));
166130
166169
  }
166170
+
166171
+ /* Clear the fromExists flag on the OR-optimized table entry so that
166172
+ ** the calls to sqlite3WhereEnd() do not code early-exits after the
166173
+ ** first row is visited. The early exit applies to this table's
166174
+ ** overall loop - including the multiple OR branches and any WHERE
166175
+ ** conditions not passed to the sub-loops - not to the sub-loops. */
166176
+ pOrTab->a[0].fg.fromExists = 0;
166131
166177
  }else{
166132
166178
  pOrTab = pWInfo->pTabList;
166133
166179
  }
@@ -166371,7 +166417,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
166371
166417
  assert( pLevel->op==OP_Return );
166372
166418
  pLevel->p2 = sqlite3VdbeCurrentAddr(v);
166373
166419
 
166374
- if( pWInfo->nLevel>1 ){ sqlite3DbFreeNN(db, pOrTab); }
166420
+ if( pWInfo->pTabList!=pOrTab ){ sqlite3DbFreeNN(db, pOrTab); }
166375
166421
  if( !untestedTerms ) disableTerm(pLevel, pTerm);
166376
166422
  }else
166377
166423
  #endif /* SQLITE_OMIT_OR_OPTIMIZATION */
@@ -176296,27 +176342,11 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
176296
176342
  }
176297
176343
  #endif /* SQLITE_DISABLE_SKIPAHEAD_DISTINCT */
176298
176344
  }
176299
- if( pTabList->a[pLevel->iFrom].fg.fromExists
176300
- && (i==pWInfo->nLevel-1
176301
- || pTabList->a[pWInfo->a[i+1].iFrom].fg.fromExists==0)
176302
- ){
176303
- /* This is an EXISTS-to-JOIN optimization which is either the
176304
- ** inner-most loop, or the inner-most of a group of nested
176305
- ** EXISTS-to-JOIN optimization loops. If this loop sees a successful
176306
- ** row, it should break out of itself as well as other EXISTS-to-JOIN
176307
- ** loops in which is is directly nested. */
176308
- int nOuter = 0; /* Nr of outer EXISTS that this one is nested within */
176309
- while( nOuter<i ){
176310
- if( !pTabList->a[pLevel[-nOuter-1].iFrom].fg.fromExists ) break;
176311
- nOuter++;
176312
- }
176313
- testcase( nOuter>0 );
176314
- sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel[-nOuter].addrBrk);
176315
- if( nOuter ){
176316
- VdbeComment((v, "EXISTS break %d..%d", i-nOuter, i));
176317
- }else{
176318
- VdbeComment((v, "EXISTS break %d", i));
176319
- }
176345
+ if( pTabList->a[pLevel->iFrom].fg.fromExists ){
176346
+ /* This is an EXISTS-to-JOIN optimization loop. If this loop sees a
176347
+ ** successful row, it should break out of itself. */
176348
+ sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrBrk);
176349
+ VdbeComment((v, "EXISTS break %d", i));
176320
176350
  }
176321
176351
  sqlite3VdbeResolveLabel(v, pLevel->addrCont);
176322
176352
  if( pLevel->op!=OP_Noop ){
@@ -184521,6 +184551,7 @@ static YYACTIONTYPE yy_reduce(
184521
184551
  yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy454, 0);
184522
184552
  if( yymsp[-4].minor.yy454 ){
184523
184553
  yymsp[-4].minor.yy454->x.pList = pList;
184554
+ sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy454);
184524
184555
  }else{
184525
184556
  sqlite3ExprListDelete(pParse->db, pList);
184526
184557
  }
@@ -234151,10 +234182,11 @@ static int sessionSerialLen(const u8 *a){
234151
234182
  int n;
234152
234183
  assert( a!=0 );
234153
234184
  e = *a;
234154
- if( e==0 || e==0xFF ) return 1;
234155
- if( e==SQLITE_NULL ) return 1;
234156
234185
  if( e==SQLITE_INTEGER || e==SQLITE_FLOAT ) return 9;
234157
- return sessionVarintGet(&a[1], &n) + 1 + n;
234186
+ if( e==SQLITE_TEXT || e==SQLITE_BLOB ){
234187
+ return sessionVarintGet(&a[1], &n) + 1 + n;
234188
+ }
234189
+ return 1;
234158
234190
  }
234159
234191
 
234160
234192
  /*
@@ -234177,17 +234209,17 @@ static unsigned int sessionChangeHash(
234177
234209
  u8 *a = aRecord; /* Used to iterate through change record */
234178
234210
 
234179
234211
  for(i=0; i<pTab->nCol; i++){
234180
- int eType = *a;
234181
234212
  int isPK = pTab->abPK[i];
234182
234213
  if( bPkOnly && isPK==0 ) continue;
234183
234214
 
234184
- assert( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT
234185
- || eType==SQLITE_TEXT || eType==SQLITE_BLOB
234186
- || eType==SQLITE_NULL || eType==0
234187
- );
234188
-
234189
234215
  if( isPK ){
234190
- a++;
234216
+ int eType = *a++;
234217
+
234218
+ assert( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT
234219
+ || eType==SQLITE_TEXT || eType==SQLITE_BLOB
234220
+ || eType==SQLITE_NULL || eType==0
234221
+ );
234222
+
234191
234223
  h = sessionHashAppendType(h, eType);
234192
234224
  if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){
234193
234225
  h = sessionHashAppendI64(h, sessionGetI64(a));
@@ -237215,9 +237247,11 @@ static int sessionChangesetBufferRecord(
237215
237247
  rc = sessionInputBuffer(pIn, nByte);
237216
237248
  }else if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){
237217
237249
  nByte += 8;
237250
+ }else if( eType!=0 && eType!=SQLITE_NULL ){
237251
+ rc = SQLITE_CORRUPT_BKPT;
237218
237252
  }
237219
237253
  }
237220
- if( (pIn->iNext+nByte)>pIn->nData ){
237254
+ if( rc==SQLITE_OK && (pIn->iNext+nByte)>pIn->nData ){
237221
237255
  rc = SQLITE_CORRUPT_BKPT;
237222
237256
  }
237223
237257
  }
@@ -263422,7 +263456,7 @@ static void fts5SourceIdFunc(
263422
263456
  ){
263423
263457
  assert( nArg==0 );
263424
263458
  UNUSED_PARAM2(nArg, apUnused);
263425
- sqlite3_result_text(pCtx, "fts5: 2026-04-09 11:41:38 4525003a53a7fc63ca75c59b22c79608659ca12f0131f52c18637f829977f20b", -1, SQLITE_TRANSIENT);
263459
+ sqlite3_result_text(pCtx, "fts5: 2026-05-05 10:34:17 c88b22011a54b4f6fbd149e9f8e4de77658ce58143a1af0e3785e4e6475127e9", -1, SQLITE_TRANSIENT);
263426
263460
  }
263427
263461
 
263428
263462
  /*
@@ -269273,9 +269307,9 @@ SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
269273
269307
 
269274
269308
  #define SQLITE3MC_VERSION_MAJOR 2
269275
269309
  #define SQLITE3MC_VERSION_MINOR 3
269276
- #define SQLITE3MC_VERSION_RELEASE 3
269310
+ #define SQLITE3MC_VERSION_RELEASE 4
269277
269311
  #define SQLITE3MC_VERSION_SUBRELEASE 0
269278
- #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.3.3"
269312
+ #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.3.4"
269279
269313
 
269280
269314
  #endif /* SQLITE3MC_VERSION_H_ */
269281
269315
  /*** End of #include "sqlite3mc_version.h" ***/
@@ -269434,12 +269468,12 @@ extern "C" {
269434
269468
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
269435
269469
  ** [sqlite_version()] and [sqlite_source_id()].
269436
269470
  */
269437
- #define SQLITE_VERSION "3.53.0"
269438
- #define SQLITE_VERSION_NUMBER 3053000
269439
- #define SQLITE_SOURCE_ID "2026-04-09 11:41:38 4525003a53a7fc63ca75c59b22c79608659ca12f0131f52c18637f829977f20b"
269440
- #define SQLITE_SCM_BRANCH "trunk"
269441
- #define SQLITE_SCM_TAGS "release major-release version-3.53.0"
269442
- #define SQLITE_SCM_DATETIME "2026-04-09T11:41:38.498Z"
269471
+ #define SQLITE_VERSION "3.53.1"
269472
+ #define SQLITE_VERSION_NUMBER 3053001
269473
+ #define SQLITE_SOURCE_ID "2026-05-05 10:34:17 c88b22011a54b4f6fbd149e9f8e4de77658ce58143a1af0e3785e4e6475127e9"
269474
+ #define SQLITE_SCM_BRANCH "branch-3.53"
269475
+ #define SQLITE_SCM_TAGS "release version-3.53.1"
269476
+ #define SQLITE_SCM_DATETIME "2026-05-05T10:34:17.344Z"
269443
269477
 
269444
269478
  /*
269445
269479
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -332785,6 +332819,7 @@ SQLITE_PRIVATE CipherParams mcChaCha20Params[] =
332785
332819
  #define PAGE_NONCE_LEN_CHACHA20 16
332786
332820
  #define PAGE_TAG_LEN_CHACHA20 16
332787
332821
  #define PAGE_RESERVED_CHACHA20 (PAGE_NONCE_LEN_CHACHA20 + PAGE_TAG_LEN_CHACHA20)
332822
+ #define OTK_LEN_CHACHA20 64
332788
332823
 
332789
332824
  typedef struct _chacha20Cipher
332790
332825
  {
@@ -332926,7 +332961,7 @@ EncryptPageChaCha20Cipher(void* cipher, int page, unsigned char* data, int len,
332926
332961
  int usePlaintextHeader = 0;
332927
332962
 
332928
332963
  /* Generate one-time keys */
332929
- uint8_t otk[64];
332964
+ uint8_t otk[OTK_LEN_CHACHA20];
332930
332965
  uint32_t counter;
332931
332966
  int offset = 0;
332932
332967
 
@@ -332955,10 +332990,10 @@ EncryptPageChaCha20Cipher(void* cipher, int page, unsigned char* data, int len,
332955
332990
  if (nReserved > 0)
332956
332991
  {
332957
332992
  /* Encrypt and authenticate */
332958
- memset(otk, 0, 64);
332993
+ memset(otk, 0, OTK_LEN_CHACHA20);
332959
332994
  chacha20_rng(data + n, PAGE_NONCE_LEN_CHACHA20);
332960
332995
  counter = LOAD32_LE(data + n + PAGE_NONCE_LEN_CHACHA20 - 4) ^ page;
332961
- chacha20_xor(otk, 64, chacha20Cipher->m_key, data + n, counter);
332996
+ chacha20_xor(otk, OTK_LEN_CHACHA20, chacha20Cipher->m_key, data + n, counter);
332962
332997
 
332963
332998
  chacha20_xor(data + offset, n - offset, otk + 32, data + n, counter + 1);
332964
332999
  if (page == 1 && usePlaintextHeader == 0)
@@ -332971,10 +333006,10 @@ EncryptPageChaCha20Cipher(void* cipher, int page, unsigned char* data, int len,
332971
333006
  {
332972
333007
  /* Encrypt only */
332973
333008
  uint8_t nonce[PAGE_NONCE_LEN_CHACHA20];
332974
- memset(otk, 0, 64);
333009
+ memset(otk, 0, OTK_LEN_CHACHA20);
332975
333010
  sqlite3mcGenerateInitialVector(page, nonce);
332976
333011
  counter = LOAD32_LE(&nonce[PAGE_NONCE_LEN_CHACHA20 - 4]) ^ page;
332977
- chacha20_xor(otk, 64, chacha20Cipher->m_key, nonce, counter);
333012
+ chacha20_xor(otk, OTK_LEN_CHACHA20, chacha20Cipher->m_key, nonce, counter);
332978
333013
 
332979
333014
  /* Encrypt */
332980
333015
  chacha20_xor(data + offset, n - offset, otk + 32, nonce, counter + 1);
@@ -332984,6 +333019,9 @@ EncryptPageChaCha20Cipher(void* cipher, int page, unsigned char* data, int len,
332984
333019
  }
332985
333020
  }
332986
333021
 
333022
+ /* Zero out otk array */
333023
+ sqlite3mcSecureZeroMemory(otk, OTK_LEN_CHACHA20);
333024
+
332987
333025
  return rc;
332988
333026
  }
332989
333027
 
@@ -333011,7 +333049,7 @@ DecryptPageChaCha20Cipher(void* cipher, int page, unsigned char* data, int len,
333011
333049
  int usePlaintextHeader = 0;
333012
333050
 
333013
333051
  /* Generate one-time keys */
333014
- uint8_t otk[64];
333052
+ uint8_t otk[OTK_LEN_CHACHA20];
333015
333053
  uint32_t counter;
333016
333054
  uint8_t tag[16];
333017
333055
  int offset = 0;
@@ -333042,9 +333080,9 @@ DecryptPageChaCha20Cipher(void* cipher, int page, unsigned char* data, int len,
333042
333080
  {
333043
333081
  int allzero = 0;
333044
333082
  /* Decrypt and verify MAC */
333045
- memset(otk, 0, 64);
333083
+ memset(otk, 0, OTK_LEN_CHACHA20);
333046
333084
  counter = LOAD32_LE(data + n + PAGE_NONCE_LEN_CHACHA20 - 4) ^ page;
333047
- chacha20_xor(otk, 64, chacha20Cipher->m_key, data + n, counter);
333085
+ chacha20_xor(otk, OTK_LEN_CHACHA20, chacha20Cipher->m_key, data + n, counter);
333048
333086
 
333049
333087
  /* Determine MAC and decrypt */
333050
333088
  allzero = chacha20_ismemset(data, 0, n);
@@ -333058,7 +333096,7 @@ DecryptPageChaCha20Cipher(void* cipher, int page, unsigned char* data, int len,
333058
333096
  {
333059
333097
  SQLITE3MC_DEBUG_LOG("decrypt: codec=%p page=%d\n", chacha20Cipher, page);
333060
333098
  SQLITE3MC_DEBUG_HEX("decrypt key:", chacha20Cipher->m_key, 32);
333061
- SQLITE3MC_DEBUG_HEX("decrypt otk:", otk, 64);
333099
+ SQLITE3MC_DEBUG_HEX("decrypt otk:", otk, OTK_LEN_CHACHA20);
333062
333100
  SQLITE3MC_DEBUG_HEX("decrypt data+00:", data, 16);
333063
333101
  SQLITE3MC_DEBUG_HEX("decrypt data+24:", data + 24, 16);
333064
333102
  SQLITE3MC_DEBUG_HEX("decrypt data+n:", data + n, 16);
@@ -333077,10 +333115,10 @@ DecryptPageChaCha20Cipher(void* cipher, int page, unsigned char* data, int len,
333077
333115
  {
333078
333116
  /* Decrypt only */
333079
333117
  uint8_t nonce[PAGE_NONCE_LEN_CHACHA20];
333080
- memset(otk, 0, 64);
333118
+ memset(otk, 0, OTK_LEN_CHACHA20);
333081
333119
  sqlite3mcGenerateInitialVector(page, nonce);
333082
333120
  counter = LOAD32_LE(&nonce[PAGE_NONCE_LEN_CHACHA20 - 4]) ^ page;
333083
- chacha20_xor(otk, 64, chacha20Cipher->m_key, nonce, counter);
333121
+ chacha20_xor(otk, OTK_LEN_CHACHA20, chacha20Cipher->m_key, nonce, counter);
333084
333122
 
333085
333123
  /* Decrypt */
333086
333124
  chacha20_xor(data + offset, n - offset, otk + 32, nonce, counter + 1);
@@ -333090,6 +333128,9 @@ DecryptPageChaCha20Cipher(void* cipher, int page, unsigned char* data, int len,
333090
333128
  }
333091
333129
  }
333092
333130
 
333131
+ /* Zero out otk array */
333132
+ sqlite3mcSecureZeroMemory(otk, OTK_LEN_CHACHA20);
333133
+
333093
333134
  return rc;
333094
333135
  }
333095
333136
 
@@ -333255,7 +333296,7 @@ AllocateSQLCipherCipher(sqlite3* db)
333255
333296
  sqlCipherCipher->m_kdfAlgorithm = sqlite3mcGetCipherParameter(cipherParams, "kdf_algorithm");
333256
333297
  sqlCipherCipher->m_hmacAlgorithm = sqlite3mcGetCipherParameter(cipherParams, "hmac_algorithm");
333257
333298
  sqlCipherCipher->m_hmacAlgorithmCompat = sqlite3mcGetCipherParameter(cipherParams, "hmac_algorithm_compat");
333258
- if (sqlCipherCipher->m_legacy >= SQLCIPHER_VERSION_4)
333299
+ if (sqlCipherCipher->m_legacy == 0 || sqlCipherCipher->m_legacy >= SQLCIPHER_VERSION_4)
333259
333300
  {
333260
333301
  sqlCipherCipher->m_plaintextHeaderSize = sqlite3mcGetCipherParameter(cipherParams, "plaintext_header_size");
333261
333302
  }
@@ -333478,9 +333519,12 @@ EncryptPageSQLCipherCipher(void* cipher, int page, unsigned char* data, int len,
333478
333519
  if (plaintextHeaderSize > 0)
333479
333520
  {
333480
333521
  usePlaintextHeader = 1;
333481
- if (sqlCipherCipher->m_legacy >= SQLCIPHER_VERSION_4)
333522
+ if (sqlCipherCipher->m_legacy == 0 || sqlCipherCipher->m_legacy >= SQLCIPHER_VERSION_4)
333482
333523
  {
333483
- offset = plaintextHeaderSize;
333524
+ if (plaintextHeaderSize > offset)
333525
+ {
333526
+ offset = plaintextHeaderSize;
333527
+ }
333484
333528
  }
333485
333529
  }
333486
333530
  }
@@ -333561,9 +333605,12 @@ DecryptPageSQLCipherCipher(void* cipher, int page, unsigned char* data, int len,
333561
333605
  if (plaintextHeaderSize > 0)
333562
333606
  {
333563
333607
  usePlaintextHeader = 1;
333564
- if (sqlCipherCipher->m_legacy >= SQLCIPHER_VERSION_4)
333608
+ if (sqlCipherCipher->m_legacy == 0 || sqlCipherCipher->m_legacy >= SQLCIPHER_VERSION_4)
333565
333609
  {
333566
- offset = plaintextHeaderSize;
333610
+ if (plaintextHeaderSize > offset)
333611
+ {
333612
+ offset = plaintextHeaderSize;
333613
+ }
333567
333614
  }
333568
333615
  }
333569
333616
  }
@@ -335285,6 +335332,9 @@ EncryptPageAscon128Cipher(void* cipher, int page, unsigned char* data, int len,
335285
335332
  }
335286
335333
  }
335287
335334
 
335335
+ /* Zero out otk array */
335336
+ sqlite3mcSecureZeroMemory(otk, ASCON_HASH_BYTES);
335337
+
335288
335338
  return rc;
335289
335339
  }
335290
335340
 
@@ -335376,6 +335426,9 @@ DecryptPageAscon128Cipher(void* cipher, int page, unsigned char* data, int len,
335376
335426
  }
335377
335427
  }
335378
335428
 
335429
+ /* Zero out otk array */
335430
+ sqlite3mcSecureZeroMemory(otk, ASCON_HASH_BYTES);
335431
+
335379
335432
  return rc;
335380
335433
  }
335381
335434
 
@@ -335779,6 +335832,9 @@ EncryptPageAegisCipher(void* cipher, int page, unsigned char* data, int len, int
335779
335832
  }
335780
335833
  }
335781
335834
 
335835
+ /* Zero out otk array */
335836
+ sqlite3mcSecureZeroMemory(otk, OTK_LEN_MAX_AEGIS);
335837
+
335782
335838
  return rc;
335783
335839
  }
335784
335840
 
@@ -335879,6 +335935,9 @@ DecryptPageAegisCipher(void* cipher, int page, unsigned char* data, int len, int
335879
335935
  }
335880
335936
  }
335881
335937
 
335938
+ /* Zero out otk array */
335939
+ sqlite3mcSecureZeroMemory(otk, OTK_LEN_MAX_AEGIS);
335940
+
335882
335941
  return rc;
335883
335942
  }
335884
335943
 
@@ -338059,7 +338118,7 @@ sqlite3mcBtreeSetPageSize(Btree* p, int pageSize, int nReserve, int iFix)
338059
338118
  ** Change 4: Call sqlite3mcBtreeSetPageSize instead of sqlite3BtreeSetPageSize for main database
338060
338119
  ** (sqlite3mcBtreeSetPageSize allows to reduce the number of reserved bytes)
338061
338120
  **
338062
- ** This code is generated by the script rekeyvacuum.sh from SQLite version 3.53.0 amalgamation.
338121
+ ** This code is generated by the script rekeyvacuum.sh from SQLite version 3.53.1 amalgamation.
338063
338122
  */
338064
338123
  SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3mcRunVacuumForRekey(
338065
338124
  char **pzErrMsg, /* Write error message here */
@@ -31,9 +31,9 @@
31
31
 
32
32
  #define SQLITE3MC_VERSION_MAJOR 2
33
33
  #define SQLITE3MC_VERSION_MINOR 3
34
- #define SQLITE3MC_VERSION_RELEASE 3
34
+ #define SQLITE3MC_VERSION_RELEASE 4
35
35
  #define SQLITE3MC_VERSION_SUBRELEASE 0
36
- #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.3.3"
36
+ #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.3.4"
37
37
 
38
38
  #endif /* SQLITE3MC_VERSION_H_ */
39
39
  /*** End of #include "sqlite3mc_version.h" ***/
@@ -192,12 +192,12 @@ extern "C" {
192
192
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
193
193
  ** [sqlite_version()] and [sqlite_source_id()].
194
194
  */
195
- #define SQLITE_VERSION "3.53.0"
196
- #define SQLITE_VERSION_NUMBER 3053000
197
- #define SQLITE_SOURCE_ID "2026-04-09 11:41:38 4525003a53a7fc63ca75c59b22c79608659ca12f0131f52c18637f829977f20b"
198
- #define SQLITE_SCM_BRANCH "trunk"
199
- #define SQLITE_SCM_TAGS "release major-release version-3.53.0"
200
- #define SQLITE_SCM_DATETIME "2026-04-09T11:41:38.498Z"
195
+ #define SQLITE_VERSION "3.53.1"
196
+ #define SQLITE_VERSION_NUMBER 3053001
197
+ #define SQLITE_SOURCE_ID "2026-05-05 10:34:17 c88b22011a54b4f6fbd149e9f8e4de77658ce58143a1af0e3785e4e6475127e9"
198
+ #define SQLITE_SCM_BRANCH "branch-3.53"
199
+ #define SQLITE_SCM_TAGS "release version-3.53.1"
200
+ #define SQLITE_SCM_DATETIME "2026-05-05T10:34:17.344Z"
201
201
 
202
202
  /*
203
203
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -21,8 +21,8 @@
21
21
  # ===
22
22
 
23
23
  YEAR="2026"
24
- VERSION="3530000"
25
- SQLITE3MC_VERSION="v2.3.3"
24
+ VERSION="3530100"
25
+ SQLITE3MC_VERSION="v2.3.4"
26
26
 
27
27
  # Defines below are sorted alphabetically
28
28
  DEFINES="
@@ -49,6 +49,7 @@ SQLITE_ENABLE_FTS5
49
49
  SQLITE_ENABLE_GEOPOLY
50
50
  SQLITE_ENABLE_JSON1
51
51
  SQLITE_ENABLE_MATH_FUNCTIONS
52
+ SQLITE_ENABLE_PERCENTILE
52
53
  SQLITE_ENABLE_RTREE
53
54
  SQLITE_ENABLE_STAT4
54
55
  SQLITE_ENABLE_UPDATE_DELETE_LIMIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-sqlite3-multiple-ciphers",
3
- "version": "12.9.0",
3
+ "version": "12.10.0",
4
4
  "description": "better-sqlite3 with multiple-cipher encryption support",
5
5
  "homepage": "https://github.com/m4heshd/better-sqlite3-multiple-ciphers",
6
6
  "author": "Mahesh Bandara Wijerathna (m4heshd) <m4heshd@gmail.com>",
@@ -18,7 +18,7 @@
18
18
  "deps/**"
19
19
  ],
20
20
  "engines": {
21
- "node": "20.x || 22.x || 23.x || 24.x"
21
+ "node": "20.x || 22.x || 23.x || 24.x || 25.x || 26.x"
22
22
  },
23
23
  "dependencies": {
24
24
  "bindings": "^1.5.0",
@@ -34,7 +34,7 @@
34
34
  "chai": "^4.3.8",
35
35
  "cli-color": "^2.0.3",
36
36
  "fs-extra": "^11.1.1",
37
- "mocha": "^10.2.0",
37
+ "mocha": "^11.7.5",
38
38
  "nodemark": "^0.3.0",
39
39
  "prebuild": "^13.0.1",
40
40
  "sqlite": "^5.0.1",