Make sure that the REGISTER token generates a valid Expr. REGISTER will
cause the tokenizer to abort, but the parser might do several reduce actions prior to that abort and those reduce actions sometimes need a valid Expr. (CVS 3980) FossilOrigin-Name: d146f01a02579339c5dc86bbe59f246bd6c05c63
This commit is contained in:
parent
e718efe113
commit
db83f8231f
15
manifest
15
manifest
@ -1,5 +1,5 @@
|
||||
C When\sconverting\sliteral\sBLOBs\sto\stext\susing\sthe\sencoding\sof\sthe\smain\ndatabase.\s\sTicket\s#2349.\s(CVS\s3975)
|
||||
D 2007-05-10T21:14:03
|
||||
C Make\ssure\sthat\sthe\sREGISTER\stoken\sgenerates\sa\svalid\sExpr.\s\sREGISTER\swill\ncause\sthe\stokenizer\sto\sabort,\sbut\sthe\sparser\smight\sdo\sseveral\sreduce\nactions\sprior\sto\sthat\sabort\sand\sthose\sreduce\sactions\ssometimes\sneed\sa\nvalid\sExpr.\s(CVS\s3980)
|
||||
D 2007-05-11T00:20:08
|
||||
F Makefile.in 87b200ad9970907f76df734d29dff3d294c10935
|
||||
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@ -70,7 +70,7 @@ F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
|
||||
F src/date.c 6049db7d5a8fdf2c677ff7d58fa31d4f6593c988
|
||||
F src/delete.c 5c0d89b3ef7d48fe1f5124bfe8341f982747fe29
|
||||
F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
|
||||
F src/expr.c 65b8a3dff2cdf1b21292996508688d5a1b93200f
|
||||
F src/expr.c 482db8506575b5b257b78cc4ca1e825731cceda4
|
||||
F src/func.c f57e0111eb0e6335d3673cd4dea3fd69aa9e8743
|
||||
F src/hash.c 67b23e14f0257b69a3e8aa663e4eeadc1a2b6fd5
|
||||
F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564
|
||||
@ -248,7 +248,8 @@ F test/fts2l.test 4c53c89ce3919003765ff4fd8d98ecf724d97dd3
|
||||
F test/fts2m.test 4b30142ead6f3ed076e880a2a464064c5ad58c51
|
||||
F test/fts2n.test a70357e72742681eaebfdbe9007b87ff3b771638
|
||||
F test/func.test 6f230b25b235cc1afcc7bd5a41baf7317018a8d1
|
||||
F test/fuzz.test 09efe2d8e4046160d5142a2f4095c41e002de951
|
||||
F test/fuzz.test db1bffeeb367b0e9147a1822db5c8c17c6f0b2ab
|
||||
F test/fuzz2.test fdbea571808441c12c91e9cd038eb77b4692d42b
|
||||
F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a
|
||||
F test/icu.test e6bfae7f625c88fd14df6f540fe835bdfc1e4329
|
||||
F test/in.test 369cb2aa1eab02296b4ec470732fe8c131260b1d
|
||||
@ -487,7 +488,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||
P a54c74990caf22c0008a7029e24594e83048ffbc
|
||||
R c84e4f74a574fa506734b720c23aad6b
|
||||
P a57afaff424448ffed8f2344e5eb461f503bfb6e
|
||||
R 1c4b57b77de749bc2a551005b3fab4dc
|
||||
U drh
|
||||
Z b06d89c3202832d761b85c19e8382942
|
||||
Z 1451f40dc8d5cea45bc2414baa2bda16
|
||||
|
@ -1 +1 @@
|
||||
a57afaff424448ffed8f2344e5eb461f503bfb6e
|
||||
d146f01a02579339c5dc86bbe59f246bd6c05c63
|
@ -12,7 +12,7 @@
|
||||
** This file contains routines used for analyzing expressions and
|
||||
** for generating VDBE code that evaluates expressions in SQLite.
|
||||
**
|
||||
** $Id: expr.c,v 1.289 2007/05/10 10:46:56 danielk1977 Exp $
|
||||
** $Id: expr.c,v 1.290 2007/05/11 00:20:08 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@ -280,9 +280,10 @@ Expr *sqlite3RegisterExpr(Parse *pParse, Token *pToken){
|
||||
Vdbe *v = pParse->pVdbe;
|
||||
Expr *p;
|
||||
int depth;
|
||||
static const Token zeroToken = { (u8*)"0", 0, 1 };
|
||||
if( pParse->nested==0 ){
|
||||
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", pToken);
|
||||
return 0;
|
||||
return sqlite3Expr(TK_INTEGER, 0, 0, &zeroToken);
|
||||
}
|
||||
if( v==0 ) return 0;
|
||||
p = sqlite3Expr(TK_REGISTER, 0, 0, pToken);
|
||||
|
@ -1,5 +1,4 @@
|
||||
|
||||
# 2001 September 15
|
||||
# 2007 May 10
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
@ -10,9 +9,11 @@
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the SELECT statement.
|
||||
# focus of this file is generating semi-random strings of SQL
|
||||
# (a.k.a. "fuzz") and sending it into the parser to try to generate
|
||||
# errors.
|
||||
#
|
||||
# $Id: fuzz.test,v 1.3 2007/05/10 17:38:57 danielk1977 Exp $
|
||||
# $Id: fuzz.test,v 1.4 2007/05/11 00:20:08 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -195,4 +196,3 @@ for {set ii 0} {$ii < 2000} {incr ii} {
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
|
97
test/fuzz2.test
Normal file
97
test/fuzz2.test
Normal file
@ -0,0 +1,97 @@
|
||||
# 2007 May 10
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library.
|
||||
#
|
||||
# This file checks error recovery from malformed SQL strings.
|
||||
#
|
||||
# $Id: fuzz2.test,v 1.1 2007/05/11 00:20:08 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
do_test fuzz2-1.1 {
|
||||
catchsql {SELECT ALL "AAAAAA" . * GROUP BY LIMIT round(1), #12}
|
||||
} {1 {near "#12": syntax error}}
|
||||
do_test fuzz2-2.0 {
|
||||
catchsql {SELECT + #100}
|
||||
} {1 {near "#100": syntax error}}
|
||||
do_test fuzz2-2.1 {
|
||||
catchsql {SELECT 1 WHERE ( #61 NOT MATCH ROUND( 1 ) )}
|
||||
} {1 {near "#61": syntax error}}
|
||||
do_test fuzz2-2.2 {
|
||||
catchsql {SELECT 1 LIMIT NOT #59 COLLATE AAAAAA NOT IN
|
||||
( "AAAAAA" NOTNULL <= x'414141414141' IS NULL , ( ROUND ( 1.0 ) ) )}
|
||||
} {1 {no such collation sequence: AAAAAA}}
|
||||
do_test fuzz2-2.3 {
|
||||
catchsql {INSERT OR REPLACE INTO AAAAAA . "AAAAAA" ( "AAAAAA" ) SELECT DISTINCT * , ( SELECT #252 IN ( SELECT DISTINCT AAAAAA . * ) )}
|
||||
} {1 {near "#252": syntax error}}
|
||||
do_test fuzz2-2.4 {
|
||||
catchsql {SELECT 1 LIMIT NOT #59 COLLATE AAAAAA NOT IN round(1.0)}
|
||||
} {1 {near "(": syntax error}}
|
||||
do_test fuzz2-2.5 {
|
||||
catchsql {SELECT( #239 )}
|
||||
} {1 {near "#239": syntax error}}
|
||||
do_test fuzz2-2.6 {
|
||||
catchsql {DELETE FROM AAAAAA WHERE #65 NOT NULL}
|
||||
} {1 {near "#65": syntax error}}
|
||||
do_test fuzz2-2.7 {
|
||||
catchsql {ATTACH ROUND( 1.0 ) in AAAAAA . "AAAAAA" AS #122 ISNULL}
|
||||
} {1 {invalid name: "ROUND( 1.0 ) in AAAAAA . "AAAAAA""}}
|
||||
do_test fuzz2-2.8 {
|
||||
catchsql {SELECT 1 LIMIT #122 ISNULL}
|
||||
} {1 {near "#122": syntax error}}
|
||||
do_test fuzz2-2.9 {
|
||||
catchsql {CREATE VIEW AAAAAA . "AAAAAA" AS SELECT DISTINCT #162 IS NULL "AAAAAA"}
|
||||
} {1 {unknown database AAAAAA}}
|
||||
do_test fuzz2-2.10 {
|
||||
catchsql {DELETE FROM AAAAAA WHERE #202 IS NOT NULL ISNULL}
|
||||
} {1 {near "#202": syntax error}}
|
||||
do_test fuzz2-2.11 {
|
||||
catchsql {UPDATE OR IGNORE "AAAAAA" . "AAAAAA" SET "AAAAAA" = NOT #96}
|
||||
} {1 {near "#96": syntax error}}
|
||||
do_test fuzz2-2.12 {
|
||||
catchsql {SELECT - #196}
|
||||
} {1 {near "#196": syntax error}}
|
||||
do_test fuzz2-3.0 {
|
||||
catchsql {CREATE TRIGGER "AAAAAA" . "AAAAAA" AFTER UPDATE OF "AAAAAA" , "AAAAAA" ON "AAAAAA" . "AAAAAA" FOR EACH ROW BEGIN UPDATE AAAAAA SET "AAAAAA" = #162; END}
|
||||
} {1 {near "#162": syntax error}}
|
||||
do_test fuzz2-3.1 {
|
||||
catchsql {CREATE TRIGGER IF NOT EXISTS "AAAAAA" UPDATE ON "AAAAAA" . AAAAAA FOR EACH ROW BEGIN DELETE FROM "AAAAAA" ; INSERT INTO AAAAAA ( "AAAAAA" ) SELECT DISTINCT "AAAAAA" "AAAAAA" , #167 AAAAAA , "AAAAAA" . * ORDER BY "AAAAAA" ASC , x'414141414141' BETWEEN RAISE ( FAIL , "AAAAAA" ) AND AAAAAA ( * ) NOT NULL DESC LIMIT AAAAAA ; REPLACE INTO AAAAAA ( AAAAAA ) VALUES ( AAAAAA ( * ) ) ; END}
|
||||
} {1 {near "#167": syntax error}}
|
||||
do_test fuzz2-3.2 {
|
||||
catchsql {CREATE TEMP TRIGGER IF NOT EXISTS AAAAAA . "AAAAAA" BEFORE UPDATE OF "AAAAAA" ON AAAAAA . "AAAAAA" BEGIN SELECT ALL * , #175 "AAAAAA" FROM "AAAAAA" . AAAAAA; END}
|
||||
} {1 {near "#175": syntax error}}
|
||||
do_test fuzz2-4.0 {
|
||||
catchsql {ATTACH DATABASE #168 AS whatever}
|
||||
} {1 {near "#168": syntax error}}
|
||||
do_test fuzz2-4.1 {
|
||||
catchsql {DETACH #133}
|
||||
} {1 {near "#133": syntax error}}
|
||||
do_test fuzz2-5.0 {
|
||||
catchsql {SELECT 1 LIMIT ( SELECT DISTINCT * , AAAAAA , * , AAAAAA , "AAAAAA" . * FROM "AAAAAA" ON ROUND( 1 ) COLLATE AAAAAA OR "AAAAAA" USING ( AAAAAA , "AAAAAA" ) WHERE ROUND( 1 ) GROUP BY ORDER BY #84 ASC , #44 DESC , ( SELECT "AAAAAA" . * , "AAAAAA" . * FROM , ( ) "AAAAAA" USING ( )}
|
||||
} {1 {near ",": syntax error}}
|
||||
do_test fuzz2-5.1 {
|
||||
catchsql {SELECT 1 WHERE 1 == AAAAAA ( * ) BETWEEN + - ~ + "AAAAAA" . AAAAAA | RAISE ( IGNORE ) COLLATE AAAAAA NOT IN ( SELECT DISTINCT "AAAAAA" . * , * , * WHERE ( SELECT ALL AAAAAA AS "AAAAAA" HAVING CAST ( "AAAAAA" . "AAAAAA" . "AAAAAA" AS AAAAAA ) ORDER BY , , IS NULL ASC , ~ AND DESC LIMIT ( ( "AAAAAA" ) NOT BETWEEN ( ) NOT IN ( ) AND AAAAAA ( ) IS NOT NULL ) OFFSET AAAAAA ( ALL , , ) ) GROUP BY ORDER BY "AAAAAA" . AAAAAA ASC , NULL IN ( SELECT UNION ALL SELECT ALL WHERE HAVING ORDER BY LIMIT UNION SELECT DISTINCT FROM ( ) WHERE + HAVING >> ORDER BY LIMIT . . , "AAAAAA" ) , CAST ( ~ "AAAAAA" . AAAAAA AS "AAAAAA" AAAAAA "AAAAAA" ( + 4294967295 , - 4294967296.0 ) ) ASC LIMIT AAAAAA INTERSECT SELECT ALL * GROUP BY , AAAAAA ( DISTINCT , ) != #241 NOT IN ( , , ) , , CTIME_KW HAVING AAAAAA ORDER BY #103 DESC , #81 ASC LIMIT AAAAAA OFFSET ~ AAAAAA ( ALL AAAAAA . AAAAAA >= AAAAAA . "AAAAAA" . "AAAAAA" ) ) NOTNULL NOT NULL}
|
||||
} {1 {near "#81": syntax error}}
|
||||
do_test fuzz2-5.2 {
|
||||
catchsql {SELECT 1 WHERE 1 == AAAAAA ( * ) BETWEEN + - ~ + "AAAAAA" . AAAAAA | RAISE ( IGNORE ) COLLATE AAAAAA NOT IN ( SELECT DISTINCT "AAAAAA" . * , * , * WHERE ( SELECT ALL AAAAAA AS "AAAAAA" HAVING CAST ( "AAAAAA" . "AAAAAA" . "AAAAAA" AS AAAAAA ) ORDER BY , , IS NULL ASC , ~ AND DESC LIMIT ( ( "AAAAAA" ) NOT BETWEEN ( ) NOT IN ( ) AND AAAAAA ( ) IS NOT NULL ) OFFSET AAAAAA ( ALL , , ) ) GROUP BY ORDER BY "AAAAAA" . AAAAAA ASC , NULL IN ( SELECT UNION ALL SELECT ALL WHERE HAVING ORDER BY LIMIT UNION SELECT DISTINCT FROM ( ) WHERE + HAVING >> ORDER BY LIMIT . . , "AAAAAA" ) , CAST ( ~ "AAAAAA" . AAAAAA AS "AAAAAA" AAAAAA "AAAAAA" ( + 4294967295 , - 4294967296.0 ) ) ASC LIMIT AAAAAA INTERSECT SELECT ALL * GROUP BY , AAAAAA ( DISTINCT , ) != #241 NOT IN ( , , ) , , CTIME_KW HAVING AAAAAA ORDER BY #103 DESC , #81 ASC LIMIT AAAAAA OFFSET ~ AAAAAA ( ALL AAAAAA . AAAAAA >= AAAAAA . "AAAAAA" . "AAAAAA" ) ) NOTNULL NOT NULL}
|
||||
} {1 {near "#81": syntax error}}
|
||||
do_test fuzz2-5.3 {
|
||||
catchsql {UPDATE "AAAAAA" SET "AAAAAA" = - EXISTS ( SELECT DISTINCT * , * ORDER BY #202 ASC , #147 , ~ AAAAAA . "AAAAAA" ASC LIMIT AAAAAA . "AAAAAA" , RAISE ( ABORT , AAAAAA ) UNION ALL SELECT DISTINCT AAAAAA . * , * FROM ( SELECT DISTINCT}
|
||||
} {1 {near "DISTINCT": syntax error}}
|
||||
do_test fuzz2-5.4 {
|
||||
catchsql {REPLACE INTO AAAAAA SELECT DISTINCT "AAAAAA" . * WHERE AAAAAA ( AAAAAA ( ) ) GROUP BY AAAAAA . AAAAAA . "AAAAAA" IN "AAAAAA" | AAAAAA ( ALL , ) ORDER BY #238, #92 DESC LIMIT 0 OFFSET - RAISE ( IGNORE ) NOT NULL > RAISE ( IGNORE ) IS NULL}
|
||||
} {1 {near "#92": syntax error}}
|
||||
do_test fuzz2-5.5 {
|
||||
catchsql {SELECT ALL * GROUP BY EXISTS ( SELECT "AAAAAA" . * , AAAAAA ( * ) AS AAAAAA FROM "AAAAAA" . "AAAAAA" AS "AAAAAA" USING ( AAAAAA , "AAAAAA" , "AAAAAA" ) WHERE AAAAAA ( DISTINCT ) - RAISE ( FAIL , "AAAAAA" ) HAVING "AAAAAA" . "AAAAAA" . AAAAAA ORDER BY #182 , #55 ) BETWEEN EXISTS ( SELECT ALL * FROM ( ( }
|
||||
} {1 {near " ": syntax error}}
|
||||
|
||||
finish_test
|
Loading…
x
Reference in New Issue
Block a user