| OLD | NEW |
| 1 # 2007 May 10 | 1 # 2007 May 10 |
| 2 # | 2 # |
| 3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
| 4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
| 5 # | 5 # |
| 6 # May you do good and not evil. | 6 # May you do good and not evil. |
| 7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
| 8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
| 9 # | 9 # |
| 10 #*********************************************************************** | 10 #*********************************************************************** |
| 11 # This file implements regression tests for SQLite library. | 11 # This file implements regression tests for SQLite library. |
| 12 # | 12 # |
| 13 # This file checks error recovery from malformed SQL strings. | 13 # This file checks error recovery from malformed SQL strings. |
| 14 # | 14 # |
| 15 # $Id: fuzz2.test,v 1.3 2007/05/15 16:51:37 drh Exp $ | |
| 16 | 15 |
| 17 set testdir [file dirname $argv0] | 16 set testdir [file dirname $argv0] |
| 18 source $testdir/tester.tcl | 17 source $testdir/tester.tcl |
| 19 | 18 |
| 20 | 19 |
| 21 proc fuzzcatch {sql} { | 20 proc fuzzcatch {sql} { |
| 22 return [lindex [catchsql $sql] 0] | 21 return [lindex [catchsql $sql] 0] |
| 23 } | 22 } |
| 24 | 23 |
| 25 do_test fuzz2-1.1 { | 24 do_test fuzz2-1.1 { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 do_test fuzz2-5.3 { | 97 do_test fuzz2-5.3 { |
| 99 fuzzcatch {UPDATE "AAAAAA" SET "AAAAAA" = - EXISTS ( SELECT DISTINCT * , * ORD
ER BY #202 ASC , #147 , ~ AAAAAA . "AAAAAA" ASC LIMIT AAAAAA . "AAAAAA" , RAISE
( ABORT , AAAAAA ) UNION ALL SELECT DISTINCT AAAAAA . * , * FROM ( SELECT DISTIN
CT} | 98 fuzzcatch {UPDATE "AAAAAA" SET "AAAAAA" = - EXISTS ( SELECT DISTINCT * , * ORD
ER BY #202 ASC , #147 , ~ AAAAAA . "AAAAAA" ASC LIMIT AAAAAA . "AAAAAA" , RAISE
( ABORT , AAAAAA ) UNION ALL SELECT DISTINCT AAAAAA . * , * FROM ( SELECT DISTIN
CT} |
| 100 } {1} | 99 } {1} |
| 101 do_test fuzz2-5.4 { | 100 do_test fuzz2-5.4 { |
| 102 fuzzcatch {REPLACE INTO AAAAAA SELECT DISTINCT "AAAAAA" . * WHERE AAAAAA ( AAA
AAA ( ) ) GROUP BY AAAAAA . AAAAAA . "AAAAAA" IN "AAAAAA" | AAAAAA ( ALL , ) ORD
ER BY #238, #92 DESC LIMIT 0 OFFSET - RAISE ( IGNORE ) NOT NULL > RAISE ( IGNORE
) IS NULL} | 101 fuzzcatch {REPLACE INTO AAAAAA SELECT DISTINCT "AAAAAA" . * WHERE AAAAAA ( AAA
AAA ( ) ) GROUP BY AAAAAA . AAAAAA . "AAAAAA" IN "AAAAAA" | AAAAAA ( ALL , ) ORD
ER BY #238, #92 DESC LIMIT 0 OFFSET - RAISE ( IGNORE ) NOT NULL > RAISE ( IGNORE
) IS NULL} |
| 103 } {1} | 102 } {1} |
| 104 do_test fuzz2-5.5 { | 103 do_test fuzz2-5.5 { |
| 105 fuzzcatch {SELECT ALL * GROUP BY EXISTS ( SELECT "AAAAAA" . * , AAAAAA ( * ) A
S AAAAAA FROM "AAAAAA" . "AAAAAA" AS "AAAAAA" USING ( AAAAAA , "AAAAAA" , "AAAAA
A" ) WHERE AAAAAA ( DISTINCT ) - RAISE ( FAIL , "AAAAAA" ) HAVING "AAAAAA" . "AA
AAAA" . AAAAAA ORDER BY #182 , #55 ) BETWEEN EXISTS ( SELECT ALL * FROM ( ( } | 104 fuzzcatch {SELECT ALL * GROUP BY EXISTS ( SELECT "AAAAAA" . * , AAAAAA ( * ) A
S AAAAAA FROM "AAAAAA" . "AAAAAA" AS "AAAAAA" USING ( AAAAAA , "AAAAAA" , "AAAAA
A" ) WHERE AAAAAA ( DISTINCT ) - RAISE ( FAIL , "AAAAAA" ) HAVING "AAAAAA" . "AA
AAAA" . AAAAAA ORDER BY #182 , #55 ) BETWEEN EXISTS ( SELECT ALL * FROM ( ( } |
| 106 } {1} | 105 } {1} |
| 107 | 106 |
| 107 # Test cases discovered by Michal Zalewski on 2015-01-03 and reported on the |
| 108 # sqlite-users mailing list. All of these cases cause segfaults in |
| 109 # SQLite 3.8.7.4 and earlier. |
| 110 # |
| 111 do_test fuzz2-6.1 { |
| 112 catchsql {SELECT n()AND+#0;} |
| 113 } {1 {near "#0": syntax error}} |
| 114 do_test fuzz2-6.2 { |
| 115 catchsql {SELECT strftime()} |
| 116 } {0 {{}}} |
| 117 do_test fuzz2-6.3 { |
| 118 catchsql {DETACH(SELECT group_concat(q));} |
| 119 } {1 {no such column: q}} |
| 120 do_test fuzz2-6.4a { |
| 121 db eval {DROP TABLE IF EXISTS t0; CREATE TABLE t0(t);} |
| 122 catchsql {INSERT INTO t0 SELECT strftime();} |
| 123 } {0 {}} |
| 124 do_test fuzz2-6.4b { |
| 125 db eval {SELECT quote(t) FROM t0} |
| 126 } {NULL} |
| 127 |
| 128 # Another test case discovered by Michal Zalewski, this on on 2015-01-22. |
| 129 # Ticket 32b63d542433ca6757cd695aca42addf8ed67aa6 |
| 130 # |
| 131 do_test fuzz2-7.1 { |
| 132 catchsql {select e.*,0 from(s,(L))e;} |
| 133 } {1 {no such table: s}} |
| 134 do_test fuzz2-7.2 { |
| 135 catchsql {SELECT c.* FROM (a,b) AS c} |
| 136 } {1 {no such table: a}} |
| 137 |
| 138 |
| 108 finish_test | 139 finish_test |
| OLD | NEW |