]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix an obscure problem associated with quoting of CSV output in the CLI.
authordrh <>
Thu, 18 Nov 2021 13:25:31 +0000 (13:25 +0000)
committerdrh <>
Thu, 18 Nov 2021 13:25:31 +0000 (13:25 +0000)
FossilOrigin-Name: 38a9b660214c06aa6650c6bb11a429a8c74c09f1e0e5c18d691e36de4af7af71

manifest
manifest.uuid
src/shell.c.in

index d42e91c2b48d9694765b76d6b674784064c5b5ff..3fbb3010529c3233ec389b0ce5208391b1b370fc 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sproblem\scausing\san\sOOM\swithin\san\sALTER\sTABLE\sADD\sCOLUMN\scommand\sthat\sadds\sa\scolumn\swith\sa\sCHECK\sconstraint\sto\sgo\sunreported.
-D 2021-11-16T13:36:50.684
+C Fix\san\sobscure\sproblem\sassociated\swith\squoting\sof\sCSV\soutput\sin\sthe\sCLI.
+D 2021-11-18T13:25:31.636
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -551,7 +551,7 @@ F src/random.c 097dc8b31b8fba5a9aca1697aeb9fd82078ec91be734c16bffda620ced7ab83c
 F src/resolve.c 4a1db4aadd802683db40ca2dbbb268187bd195f10cbdb7206dbd8ac988795571
 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
 F src/select.c 187e57a53c747e4d05b5751b133434574e333b512a5c89773d33cac06860f412
-F src/shell.c.in f8854bcb0d14707d661732698d5210d7f01694000c46e8014b323ad18f575be6
+F src/shell.c.in 110c63de78d63a678e9b46e376ea6b8498ab62726dc84dca32161fe88acf325e
 F src/sqlite.h.in 5cd209ac7dc4180f0e19292846f40440b8488015849ca0110c70b906b57d68f0
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h 8ff2fd2c166150b2e48639f5e506fb44e29f1a3f65031710b9e89d1c126ac839
@@ -1933,7 +1933,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 bd66ab8a1bc3c43a57c7caff5f54545b0feb0177f1f51492f30d308c123c43ba
-R 8e910d7ef9b9683ef8c5339395ac64ec
-U dan
-Z ce8501e7bda0295d8dc505431c6919db
+P a33f5e93ecb7d84291f6fecc7b60f0c555034aa47e24584c63c78d8a94710d82
+R 5b5c595cccff4840ecd5a386ffa8a172
+U drh
+Z 83dd77702836190e973908b753380a9f
index 2f4df70c9234d193e951cea62fd7f8846f2a1856..8e749dbf155e2c8ec06da015fba63a9659b8e699 100644 (file)
@@ -1 +1 @@
-a33f5e93ecb7d84291f6fecc7b60f0c555034aa47e24584c63c78d8a94710d82
\ No newline at end of file
+38a9b660214c06aa6650c6bb11a429a8c74c09f1e0e5c18d691e36de4af7af71
\ No newline at end of file
index f136103b34a99ec82c886236819726224317a1b0..672c80a25bf2ecbe45ef70fa23d3ca3adbe6de87 100644 (file)
@@ -1764,10 +1764,12 @@ static void output_csv(ShellState *p, const char *z, int bSep){
   }else{
     int i;
     int nSep = strlen30(p->colSeparator);
-    for(i=0; z[i]; i++){
+    int n = strlen30(z);
+    for(i=0; i<n; i++){
       if( needCsvQuote[((unsigned char*)z)[i]]
-         || (z[i]==p->colSeparator[0] &&
-             (nSep==1 || memcmp(z, p->colSeparator, nSep)==0)) ){
+       || (z[i]==p->colSeparator[0] &&
+             (nSep==1 || (i+nSep<n && memcmp(z+i, p->colSeparator, nSep)==0)))
+      ){
         i = 0;
         break;
       }