From: drh <> Date: Sat, 27 Sep 2025 13:00:37 +0000 (+0000) Subject: Use sqlite3_malloc64() and sqlite3_realloc64() everywhere in the CLI. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c090488133359762c97956254d14f487cde0c9c5;p=thirdparty%2Fsqlite.git Use sqlite3_malloc64() and sqlite3_realloc64() everywhere in the CLI. FossilOrigin-Name: b05c47009120840f74955114082f3a9c1206a81bd935a503fc359b5bde61c996 --- diff --git a/manifest b/manifest index 526892f8d3..d1d776feb9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sbug\sin\sthe\s".dbtotxt"\scommand\sof\sthe\sCLI\sthat\scauses\sa\sNULL\spointer\ndereference\sif\srun\son\san\sin-memory\sdatabase. -D 2025-09-27T12:35:25.533 +C Use\ssqlite3_malloc64()\sand\ssqlite3_realloc64()\severywhere\sin\sthe\sCLI. +D 2025-09-27T13:00:37.088 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -737,7 +737,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c f8d1d011aba0964ff1bdccd049d4d2c2fec217efd90d202a4bb775e926b2c25d F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c b95181711d59c36d9789e67f76c4cfec64b99f9629a50be5e6566e117b87d957 -F src/shell.c.in 55d5d7828b6dc81dda64972949f2849b6a76462824381dbd1aae6af914baea76 +F src/shell.c.in 0ab96b4d875ec03e1b5d0c97aa3f2f68d3b6c926f270488e26f3088d17554811 F src/sqlite.h.in 5732519a2acb09066032ceac21f25996eb3f28f807a4468e30633c7c70faae1c F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 F src/sqlite3ext.h 3f0c4ed6934e7309a61c6f3c30f70a30a5b869f785bb3d9f721a36c5e4359126 @@ -2169,8 +2169,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P a8093d45e0f59fd55ea4cba515e9e2eb3683bb0a4f4c062747cfb4074ae3db73 -R 3cc13d1240f97a4dacee1c0779f36f7a +P 865352499223c3bdc5cb01a2f984d6e3fe74a028ab6a0cf2d92fec49383633f6 +R 8bd4bde493e0eb54d65eb66f6ba457ae U drh -Z db1677511b380f07639c77d73f13747a +Z c33262b9d6d9f5e2eac9a7be85ed3b9e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 2c3ae7dead..971d62333e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -865352499223c3bdc5cb01a2f984d6e3fe74a028ab6a0cf2d92fec49383633f6 +b05c47009120840f74955114082f3a9c1206a81bd935a503fc359b5bde61c996 diff --git a/src/shell.c.in b/src/shell.c.in index d7514fb454..4d9d0a876f 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -4819,7 +4819,7 @@ static char **tableColumnList(ShellState *p, const char *zTab){ sqlite3_stmt *pStmt; char *zSql; int nCol = 0; - int nAlloc = 0; + i64 nAlloc = 0; int nPK = 0; /* Number of PRIMARY KEY columns seen */ int isIPK = 0; /* True if one PRIMARY KEY column of type INTEGER */ int preserveRowid = ShellHasFlag(p, SHFLG_PreserveRowid); @@ -4833,7 +4833,7 @@ static char **tableColumnList(ShellState *p, const char *zTab){ while( sqlite3_step(pStmt)==SQLITE_ROW ){ if( nCol>=nAlloc-2 ){ nAlloc = nAlloc*2 + nCol + 10; - azCol = sqlite3_realloc(azCol, nAlloc*sizeof(azCol[0])); + azCol = sqlite3_realloc64(azCol, nAlloc*sizeof(azCol[0])); shell_check_oom(azCol); } azCol[++nCol] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 1)); @@ -5676,7 +5676,7 @@ static unsigned char *readHexDb(ShellState *p, int *pnData){ goto readHexDb_error; } sz = ((i64)n+pgsz-1)&~(pgsz-1); /* Round up to nearest multiple of pgsz */ - a = sqlite3_malloc( sz ? sz : 1 ); + a = sqlite3_malloc64( sz ? sz : 1 ); shell_check_oom(a); memset(a, 0, sz); for(nLine++; sqlite3_fgets(zLine, sizeof(zLine), in)!=0; nLine++){ @@ -8932,7 +8932,7 @@ static int do_meta_command(char *zLine, ShellState *p){ const char *zSchema = (const char *)sqlite3_column_text(pStmt,1); const char *zFile = (const char*)sqlite3_column_text(pStmt,2); if( zSchema==0 || zFile==0 ) continue; - azName = sqlite3_realloc(azName, (nName+1)*2*sizeof(char*)); + azName = sqlite3_realloc64(azName, (nName+1)*2*sizeof(char*)); shell_check_oom(azName); azName[nName*2] = strdup(zSchema); azName[nName*2+1] = strdup(zFile); @@ -10990,7 +10990,8 @@ static int do_meta_command(char *zLine, ShellState *p){ ** Set a list of GLOB patterns of table names to be excluded. */ if( cli_strcmp(azCmd[0], "filter")==0 ){ - int ii, nByte; + int ii; + i64 nByte; if( nCmd<2 ) goto session_syntax_error; if( pAuxDb->nSession ){ for(ii=0; iinFilter; ii++){ @@ -10998,7 +10999,7 @@ static int do_meta_command(char *zLine, ShellState *p){ } sqlite3_free(pSession->azFilter); nByte = sizeof(pSession->azFilter[0])*(nCmd-1); - pSession->azFilter = sqlite3_malloc( nByte ); + pSession->azFilter = sqlite3_malloc64( nByte ); shell_check_oom( pSession->azFilter ); for(ii=1; iiazFilter[ii-1] = sqlite3_mprintf("%s", azCmd[ii]);