From: drh <> Date: Thu, 8 Jul 2021 12:12:39 +0000 (+0000) Subject: Fix an issue with the SQLite Expert extension when a column has no X-Git-Tag: version-3.37.0~349 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=77ea22300b5bcc0961be5c2578a262d91917cf1f;p=thirdparty%2Fsqlite.git Fix an issue with the SQLite Expert extension when a column has no collating sequence. [forum:/forumpost/78165fa250|Forum post 78165fa250]. FossilOrigin-Name: b1e0c22ec981cf5f8a6597abc6711b1a25019dd51de31129fbc504d3dc743bb4 --- diff --git a/ext/expert/sqlite3expert.c b/ext/expert/sqlite3expert.c index 863c6a3409..15077f5cbf 100644 --- a/ext/expert/sqlite3expert.c +++ b/ext/expert/sqlite3expert.c @@ -690,11 +690,13 @@ static int idxGetTableInfo( rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_xinfo=%Q", zTab); while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){ const char *zCol = (const char*)sqlite3_column_text(p1, 1); + const char *zColSeq = 0; nByte += 1 + STRLEN(zCol); rc = sqlite3_table_column_metadata( - db, "main", zTab, zCol, 0, &zCol, 0, 0, 0 + db, "main", zTab, zCol, 0, &zColSeq, 0, 0, 0 ); - nByte += 1 + STRLEN(zCol); + if( zColSeq==0 ) zColSeq = "binary"; + nByte += 1 + STRLEN(zColSeq); nCol++; nPk += (sqlite3_column_int(p1, 5)>0); } @@ -714,6 +716,7 @@ static int idxGetTableInfo( nCol = 0; while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){ const char *zCol = (const char*)sqlite3_column_text(p1, 1); + const char *zColSeq = 0; int nCopy = STRLEN(zCol) + 1; pNew->aCol[nCol].zName = pCsr; pNew->aCol[nCol].iPk = (sqlite3_column_int(p1, 5)==1 && nPk==1); @@ -721,12 +724,13 @@ static int idxGetTableInfo( pCsr += nCopy; rc = sqlite3_table_column_metadata( - db, "main", zTab, zCol, 0, &zCol, 0, 0, 0 + db, "main", zTab, zCol, 0, &zColSeq, 0, 0, 0 ); if( rc==SQLITE_OK ){ - nCopy = STRLEN(zCol) + 1; + if( zColSeq==0 ) zColSeq = "binary"; + nCopy = STRLEN(zColSeq) + 1; pNew->aCol[nCol].zColl = pCsr; - memcpy(pCsr, zCol, nCopy); + memcpy(pCsr, zColSeq, nCopy); pCsr += nCopy; } diff --git a/manifest b/manifest index 091888b3a5..e0a44eea1f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sharmless\scompiler\swarning\sin\sthe\s"fuzzcheck"\stest\sprogram. -D 2021-07-07T19:44:32.000 +C Fix\san\sissue\swith\sthe\sSQLite\sExpert\sextension\swhen\sa\scolumn\shas\sno\ncollating\ssequence.\n[forum:/forumpost/78165fa250|Forum\spost\s78165fa250]. +D 2021-07-08T12:12:39.946 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -51,7 +51,7 @@ F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a4980828 F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3 F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4 F ext/expert/expert1.test 6703fd74711daf8230240680b0a348d0720e28819b602701adfbd32457fdcddd -F ext/expert/sqlite3expert.c de51b187c629a4c4264d5de0b77862641e11426f7a963a92abf2d4077085fc8c +F ext/expert/sqlite3expert.c fdcd3bd969351c4e860a1368a6ab64bc4c94d2d89396805b28853a514d06fd92 F ext/expert/sqlite3expert.h ca81efc2679a92373a13a3e76a6138d0310e32be53d6c3bfaedabd158ea8969b F ext/expert/test_expert.c d56c194b769bdc90cf829a14c9ecbc1edca9c850b837a4d0b13be14095c32a72 F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e @@ -1920,7 +1920,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5bc05faf279e0c98be83cb6d56f669a60ff515c8244fca6280991ed0dc5e7ae7 -R d0f6dc65d71cb7fb1236a5ce0cb825e4 +P 8c432642572c8c4b7251f413def0725b3b8e9e7fe10230aa0aabe86b58e5902d +R 071d661bdc6fd21184ca44df9d313bc9 U drh -Z 9d91a738af940d242f9894375fc29625 +Z 1681065afffdc03570a282c19a0930fc diff --git a/manifest.uuid b/manifest.uuid index 748213b830..43a5120cf5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8c432642572c8c4b7251f413def0725b3b8e9e7fe10230aa0aabe86b58e5902d \ No newline at end of file +b1e0c22ec981cf5f8a6597abc6711b1a25019dd51de31129fbc504d3dc743bb4 \ No newline at end of file