]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix an off-by-one error that causes a quoted empty string at the end of
authordrh <drh@noemail.net>
Wed, 28 Aug 2013 13:33:40 +0000 (13:33 +0000)
committerdrh <drh@noemail.net>
Wed, 28 Aug 2013 13:33:40 +0000 (13:33 +0000)
a CRNL-terminated line of CSV input to be misread by the shell.

FossilOrigin-Name: b5617e4fdadc4cded93c985008e90982dd48bc3b

manifest
manifest.uuid
src/shell.c
test/shell5.test

index 8f40323e8e9dd89f9a273acfc5f53ba7fa81ca82..8a6b4333e9eafb7d8bc1ef58d6271eb29c54e53c 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sa\stest\scase\sfor\sempty\squoted\sfield\sin\sCSV\simport\sin\sthe\sshell.
-D 2013-08-28T11:57:52.201
+C Fix\san\soff-by-one\serror\sthat\scauses\sa\squoted\sempty\sstring\sat\sthe\send\sof\na\sCRNL-terminated\sline\sof\sCSV\sinput\sto\sbe\smisread\sby\sthe\sshell.
+D 2013-08-28T13:33:40.242
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -217,7 +217,7 @@ F src/random.c 0b2dbc37fdfbfa6bd455b091dfcef5bdb32dba68
 F src/resolve.c 9d53899cc6e1f4ec0b4632d07e97d57827bf63b9
 F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
 F src/select.c 8b148eb851f384412aea57091659d14b369918ca
-F src/shell.c 00a23311466829d9b77f0be4f7cedee9328279db
+F src/shell.c f726500a48dbc64d42e82b439ca7690a1e1a46cf
 F src/sqlite.h.in bd1451ba1ab681022a53bccc3c39580ba094a3ff
 F src/sqlite3.rc fea433eb0a59f4c9393c8e6d76a6e2596b1fe0c0
 F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc
@@ -784,7 +784,7 @@ F test/shell1.test 928547277d385038c696428e9d791cbbad098974
 F test/shell2.test 037d6ad16e873354195d30bb2dc4b5321788154a
 F test/shell3.test 9196c42772d575685e722c92b4b39053c6ebba59
 F test/shell4.test aa4eef8118b412d1a01477a53426ece169ea86a9
-F test/shell5.test 174a2a3df73ae5caf2cf74d5232fd869a841ecec
+F test/shell5.test bfa21ecc173adcbc15db2c075baa468778f67f88
 F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3
 F test/shrink.test 8c70f62b6e8eb4d54533de6d65bd06b1b9a17868
 F test/sidedelete.test f0ad71abe6233e3b153100f3b8d679b19a488329
@@ -1107,7 +1107,7 @@ F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
 F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae
 F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
-P b5ccf6e995ac2fe010f49d46d40b487ddbd28e5a
-R df6774582c305a98ada1f84d02d89329
+P 3df56e849164811117f9ac8ee2aee1eee188bb96
+R eb7817bc730740034eb3fac54ffa268e
 U drh
-Z e58789328f00ee55080b8aec43c720b4
+Z 72d0cf2bcd39280bc82cec788bca9ff5
index bfb4c5f3846fd64ec1ddb9f48c6a971942dea076..89c381c25a30eb31823fd305cd29de88f69f1164 100644 (file)
@@ -1 +1 @@
-3df56e849164811117f9ac8ee2aee1eee188bb96
\ No newline at end of file
+b5617e4fdadc4cded93c985008e90982dd48bc3b
\ No newline at end of file
index f8ee08a80372ccef62c3600b5300b263f63b8a20..455fa5ca2246910dac123f727c0f6b3d4c5d0200 100644 (file)
@@ -1717,7 +1717,7 @@ static char *csv_read_one_field(CSVReader *p){
       }
       if( (c==cSep && pc==cQuote)
        || (c=='\n' && pc==cQuote)
-       || (c=='\n' && pc=='\r' && p->n>2 && p->z[p->n-2]==cQuote)
+       || (c=='\n' && pc=='\r' && p->n>=2 && p->z[p->n-2]==cQuote)
        || (c==EOF && pc==cQuote)
       ){
         do{ p->n--; }while( p->z[p->n]!=cQuote );
index d881b96d1472edeff38696b9bcba78a62c1a12a1..bee4563372a4e86e776223bc81555317cfe107cd 100644 (file)
@@ -249,7 +249,7 @@ do_test shell5-1.9 {
   puts $out {2,"x",22}
   puts $out {3,"""",33}
   puts $out {4,"hello",44}
-  puts $out {5,55,""}
+  puts $out "5,55,\"\"\r"
   puts $out {6,66,"x"}
   puts $out {7,77,""""}
   puts $out {8,88,"hello"}