From: drh <> Date: Wed, 15 Oct 2025 10:52:45 +0000 (+0000) Subject: Fix memory allocation in the ".table" command of the .cli when the number X-Git-Tag: major-release~69 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=34c1e04cbf1b5d7af6bc11e0b078d1853b996bd0;p=thirdparty%2Fsqlite.git Fix memory allocation in the ".table" command of the .cli when the number of tables in the database file approaches 2 billion. FossilOrigin-Name: 5cbccab499bc3983aac1f57355552db607dee6c7ef4eb00d794dbee89c18db70 --- diff --git a/manifest b/manifest index b2da34881f..c74317dcc2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Reestablish\sAPIARMOR\sfor\sthe\ssqlite3_db_status()\sinterface. -D 2025-10-14T19:21:46.782 +C Fix\smemory\sallocation\sin\sthe\s".table"\scommand\sof\sthe\s.cli\swhen\sthe\snumber\nof\stables\sin\sthe\sdatabase\sfile\sapproaches\s2\sbillion. +D 2025-10-15T10:52:45.276 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -736,7 +736,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 8f83f3568b5e0bea36a863f26a2a0b2ace99ee3b51513565b7fc27e2920b80f7 +F src/shell.c.in f5243232283bdafe9804cdfb02d3d6dbfd992a69e88e911726053a4c6959d41f F src/sqlite.h.in 10faecc456d3962c7cedae70d69305f7c80129f28dd8524bd8a06b3eac955e54 F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 F src/sqlite3ext.h 7f236ca1b175ffe03316d974ef57df79b3938466c28d2f95caef5e08c57f3a52 @@ -2171,8 +2171,8 @@ F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6dd F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b13eafc9b6820517b450041a7e2be573a896b5b9e88b2b28df9f15e3cb91e23d -R 403733d8e52826cb8fde832a34128243 +P 1738f0bdf5941a70684c82d2040561e53a272595026a837a9f9bab8508a46480 +R 1dbf964e481b54df9bb3b131a4237ef8 U drh -Z d822c2efc819b4fac870aadf1e2f6261 +Z fd056c381ae9f263080e8efcbef5c8b3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ec0bee3dd5..26a9041328 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1738f0bdf5941a70684c82d2040561e53a272595026a837a9f9bab8508a46480 +5cbccab499bc3983aac1f57355552db607dee6c7ef4eb00d794dbee89c18db70 diff --git a/src/shell.c.in b/src/shell.c.in index e02833d2f4..51dc4cbf54 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -11671,10 +11671,10 @@ static int do_meta_command(char *zLine, ShellState *p){ while( sqlite3_step(pStmt)==SQLITE_ROW ){ if( nRow>=nAlloc ){ char **azNew; - int n2 = nAlloc*2 + 10; + sqlite3_int64 n2 = 2*(sqlite3_int64)nAlloc + 10; azNew = sqlite3_realloc64(azResult, sizeof(azResult[0])*n2); shell_check_oom(azNew); - nAlloc = n2; + nAlloc = (int)n2; azResult = azNew; } azResult[nRow] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 0));