diff --git a/patch/0012-Bugfix-on-current-version.patch b/patch/0012-Bugfix-on-current-version.patch index 526bfcdb67dddc6d954a94d1b1ec624378147fb8..f69f291586e79ee3590cd4eb7cce942baa6d31ea 100644 --- a/patch/0012-Bugfix-on-current-version.patch +++ b/patch/0012-Bugfix-on-current-version.patch @@ -1,17 +1,17 @@ -From 039a72cf82f44a36eb3863f55c6d135a5f913a39 Mon Sep 17 00:00:00 2001 +From bfdc0c35161fc7fbc46994c4f6d8874121e3fece Mon Sep 17 00:00:00 2001 From: MartinChoo <214582617@qq.com> Date: Thu, 10 Jul 2025 10:46:18 +0800 -Subject: [PATCH 4/4] Bugfix on current version +Subject: [PATCH] Bugfix on current version --- - src/sqlite3.c | 251 ++++++++++++++++++++++++++++++++++++++++---------- - 1 file changed, 203 insertions(+), 48 deletions(-) + src/sqlite3.c | 255 ++++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 206 insertions(+), 49 deletions(-) diff --git a/src/sqlite3.c b/src/sqlite3.c -index 3dc54be..a683ca7 100644 +index 7f8a432..0b86796 100644 --- a/src/sqlite3.c +++ b/src/sqlite3.c -@@ -38802,8 +38802,8 @@ static void enableDbFileDelMonitor(int32_t fd) +@@ -38805,8 +38805,8 @@ static void enableDbFileDelMonitor(int32_t fd) } flags |= HMFS_MONITOR_FL; ret = ioctl(fd, HMFS_IOCTL_HW_SET_FLAGS, &flags); @@ -22,7 +22,18 @@ index 3dc54be..a683ca7 100644 } } -@@ -57978,6 +57978,8 @@ static void MetaDwrCheckVacuum(BtShared *pBt); +@@ -54423,7 +54423,9 @@ bitvec_set_rehash: + }else{ + memcpy(aiValues, p->u.aHash, sizeof(p->u.aHash)); + memset(p->u.apSub, 0, sizeof(p->u.apSub)); +- p->iDivisor = (p->iSize + BITVEC_NPTR - 1)/BITVEC_NPTR; ++ p->iDivisor = p->iSize/BITVEC_NPTR; ++ if( (p->iSize%BITVEC_NPTR)!=0 ) p->iDivisor++; ++ if( p->iDivisoriDivisor = BITVEC_NBIT; + rc = sqlite3BitvecSet(p, i); + for(j=0; jpPCache, pPager->dbSize); } #ifdef SQLITE_META_DWR @@ -49,7 +60,7 @@ index 3dc54be..a683ca7 100644 } #endif if( pagerUseWal(pPager) ){ -@@ -73740,7 +73743,13 @@ static void zeroPage(MemPage *pPage, int flags){ +@@ -73743,7 +73748,13 @@ static void zeroPage(MemPage *pPage, int flags){ data[hdr+7] = 0; put2byte(&data[hdr+5], pBt->usableSize); pPage->nFree = (u16)(pBt->usableSize - first); @@ -64,7 +75,7 @@ index 3dc54be..a683ca7 100644 pPage->cellOffset = first; pPage->aDataEnd = &data[pBt->pageSize]; pPage->aCellIdx = &data[first]; -@@ -73949,7 +73958,9 @@ static void pageReinit(DbPage *pData){ +@@ -73952,7 +73963,9 @@ static void pageReinit(DbPage *pData){ ** But no harm is done by this. And it is very important that ** btreeInitPage() be called on every btree page so we make ** the call for every page that comes in for re-initializing. */ @@ -75,7 +86,7 @@ index 3dc54be..a683ca7 100644 } } } -@@ -74865,6 +74876,11 @@ static int lockBtree(BtShared *pBt){ +@@ -74868,6 +74881,11 @@ static int lockBtree(BtShared *pBt){ } if( nPage>nPageFile ){ if( sqlite3WritableSchema(pBt->db)==0 ){ @@ -87,7 +98,7 @@ index 3dc54be..a683ca7 100644 rc = SQLITE_CORRUPT_BKPT; goto page1_init_failed; }else{ -@@ -121725,8 +121741,8 @@ static void attachFunc( +@@ -121728,8 +121746,8 @@ static void attachFunc( if( rc==SQLITE_OK ){ extern int sqlite3CodecAttach(sqlite3*, int, const void*, int); extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*); @@ -98,7 +109,7 @@ index 3dc54be..a683ca7 100644 int t = sqlite3_value_type(argv[2]); switch( t ){ case SQLITE_INTEGER: -@@ -121743,14 +121759,7 @@ static void attachFunc( +@@ -121746,14 +121764,7 @@ static void attachFunc( break; case SQLITE_NULL: @@ -114,7 +125,7 @@ index 3dc54be..a683ca7 100644 break; } } -@@ -184118,10 +184127,12 @@ opendb_out: +@@ -184121,10 +184132,12 @@ opendb_out: db->eOpenState = SQLITE_STATE_SICK; } #ifdef SQLITE_ENABLE_DROPTABLE_CALLBACK @@ -131,7 +142,7 @@ index 3dc54be..a683ca7 100644 #endif /* SQLITE_ENABLE_DROPTABLE_CALLBACK */ #ifdef SQLITE_ENABLE_BINLOG sqlite3BinlogReset(db); -@@ -204567,6 +204578,39 @@ static int fts3ExprTermOffsetInit(Fts3Expr *pExpr, int iPhrase, void *ctx){ +@@ -204570,6 +204583,39 @@ static int fts3ExprTermOffsetInit(Fts3Expr *pExpr, int iPhrase, void *ctx){ return rc; } @@ -171,7 +182,7 @@ index 3dc54be..a683ca7 100644 /* ** Implementation of offsets() function. */ -@@ -204603,6 +204647,12 @@ SQLITE_PRIVATE void sqlite3Fts3Offsets( +@@ -204606,6 +204652,12 @@ SQLITE_PRIVATE void sqlite3Fts3Offsets( sCtx.iDocid = pCsr->iPrevId; sCtx.pCsr = pCsr; @@ -184,7 +195,7 @@ index 3dc54be..a683ca7 100644 /* Loop through the table columns, appending offset information to ** string-buffer res for each column. */ -@@ -254789,7 +254839,20 @@ SQLITE_API int sqlite3_stmt_init( +@@ -254792,7 +254844,20 @@ SQLITE_API int sqlite3_stmt_init( /* Return the source-id for this library */ SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } /************************** End of sqlite3.c ******************************/ @@ -206,7 +217,7 @@ index 3dc54be..a683ca7 100644 #ifdef SQLITE_HAS_CODEC /************** Begin file hw_codec_openssl.h *******************************/ #ifndef EXPOSE_INTERNAL_FUNC -@@ -255983,6 +256046,7 @@ int sqlite3CodecAttach(sqlite3* db, int nDb, const void *pKey, int nKey){ +@@ -255986,6 +256051,7 @@ int sqlite3CodecAttach(sqlite3* db, int nDb, const void *pKey, int nKey){ } } #endif @@ -214,7 +225,7 @@ index 3dc54be..a683ca7 100644 #ifdef SQLITE_CODEC_ATTACH_CHANGED int rc = sqlite3CodecInitContext(ctx, p, pKey, nKey, nDb); #else -@@ -256586,7 +256650,12 @@ typedef struct MetaDwrHdr { +@@ -256589,7 +256655,12 @@ typedef struct MetaDwrHdr { u32 pageSz; u32 pageCnt; u64 dbFileInode; @@ -228,7 +239,7 @@ index 3dc54be..a683ca7 100644 u32 checkSum; u8 *zones; Pgno *pages; -@@ -256951,6 +257020,87 @@ static inline u64 CaculateMetaDwrWriteOffset(int pageSz, u32 idx, u8 zone) { +@@ -256954,6 +257025,87 @@ static inline u64 CaculateMetaDwrWriteOffset(int pageSz, u32 idx, u8 zone) { return META_DWR_HEADER_PAGE_SIZE + pageSz * (idx * 2 + zone); } @@ -316,7 +327,7 @@ index 3dc54be..a683ca7 100644 static void MetaDwrUpdateHeaderDbInfo(BtShared *pBt) { MetaDwrHdr *hdr = pBt->pPager->metaHdr; // 28 offset: dbSize, freelist pageNo, freelist pages count, schema cookie -@@ -257171,11 +257321,12 @@ static int MetaDwrOpenFile(Pager *pPager, u8 openCreate) { +@@ -257174,11 +257326,12 @@ static int MetaDwrOpenFile(Pager *pPager, u8 openCreate) { if (pPager->metaMapPage == NULL) { sqlite3_int64 sz = META_DWR_HEADER_PAGE_SIZE; sqlite3OsFileControlHint(metaFd, SQLITE_FCNTL_CHUNK_SIZE, &sz); @@ -334,7 +345,7 @@ index 3dc54be..a683ca7 100644 } } #endif /* SQLITE_OS_UNIX */ -@@ -257549,7 +257700,7 @@ CHK_RESTORE_OUT: +@@ -257552,7 +257705,7 @@ CHK_RESTORE_OUT: return rc; } @@ -343,7 +354,7 @@ index 3dc54be..a683ca7 100644 { #if SQLITE_OS_UNIX if (pPager->pVfs == NULL) { -@@ -257563,10 +257714,18 @@ static inline u8 IsConnectionValidForCheck(Pager *pPager) +@@ -257566,10 +257719,18 @@ static inline u8 IsConnectionValidForCheck(Pager *pPager) checkFileId = SQLITE_CHECK_FILE_ID_CKSM; } unixFile *fd = Sqlite3GetUnixFile(pPager->fd, checkFileId); @@ -363,7 +374,7 @@ index 3dc54be..a683ca7 100644 return 1; #else return 0; -@@ -257576,7 +257735,7 @@ static inline u8 IsConnectionValidForCheck(Pager *pPager) +@@ -257579,7 +257740,7 @@ static inline u8 IsConnectionValidForCheck(Pager *pPager) static int MetaDwrOpenAndCheck(Btree *pBt) { Pager *pPager = pBt->pBt->pPager; @@ -372,7 +383,7 @@ index 3dc54be..a683ca7 100644 return SQLITE_OK; } #ifdef SQLITE_HAS_CODEC -@@ -257621,7 +257780,7 @@ DWR_OPEN_OUT: +@@ -257624,7 +257785,7 @@ DWR_OPEN_OUT: static void MetaDwrDisable(Btree *pBt) { Pager *pPager = pBt->pBt->pPager; @@ -381,7 +392,7 @@ index 3dc54be..a683ca7 100644 return; } #ifdef SQLITE_HAS_CODEC -@@ -257647,19 +257806,6 @@ static void MetaDwrDisable(Btree *pBt) +@@ -257650,19 +257811,6 @@ static void MetaDwrDisable(Btree *pBt) #endif /* SQLITE_META_DWR */ #if SQLITE_OS_UNIX @@ -401,7 +412,7 @@ index 3dc54be..a683ca7 100644 static void ResetLockStatus(void) { (void)memset(&g_lockStatus, 0, sizeof(g_lockStatus)); -@@ -257763,8 +257909,13 @@ static inline const char *FlockToName(int l_type) +@@ -257766,8 +257914,13 @@ static inline const char *FlockToName(int l_type) static int DumpProcessLocks(int fd, struct flock *lock, const char *lockName, char *dumpBuf, int bufLen) { @@ -416,7 +427,7 @@ index 3dc54be..a683ca7 100644 sqlite3_log(SQLITE_ERROR, "[SQLite]Get wal file lock ofs %u failed, errno: %d", lock->l_start, errno); return 0; } -@@ -259021,7 +259172,11 @@ struct sqlite3_api_routines_hw { +@@ -259022,7 +259175,11 @@ struct sqlite3_api_routines_hw { int (*rekey_v2)(sqlite3*,const char*,const void*,int); int (*is_support_binlog)(void); int (*replay_binlog)(sqlite3*, sqlite3*); @@ -429,5 +440,5 @@ index 3dc54be..a683ca7 100644 int (*compressdb_backup)(sqlite3*, const char*); #else -- -2.47.0.windows.2 +2.28.0.windows.1