Closed MarinPostma closed 5 months ago
If you are interested, you should be able to generate more crash tests by patching this with: (you can try first without the patch to check many valid SQLite commands)
misc % diff -u test-grammar.pegjs*
--- test-grammar.pegjs 2024-02-26 20:00:37.000000000 +0100
+++ test-grammar.pegjs.bk 2024-02-26 20:00:06.000000000 +0100
@@ -42,7 +42,8 @@
return b;
}
test_type_start
- = "do_execsql_test"
+ = "do_catchsql_test"
+ / "do_execsql_test"
/ "do_eqp_test"
/ "execsql"
/ "eqp"
Create a symlink to a local clone of official SQLite3 repository:
% cd sqlite-parser/test
% ln -s ~/sqlite/test raw
Launch
% cd sqlite-parser/test/misc
% sh process-tests.sh
And then with lemon-rs
% find ~/sqlite-parser/test/sql/official-suite/ -type f | xargs ./target/debug/examples/sql_cmds 2> errors.txt > /dev/null
oh that's cool! thanks @gwenn I'll give it a shot 👍
SELECT (SELECT max(x)OVER(ORDER BY x) % min(x)OVER(ORDER BY CASE x WHEN 889 THEN x WHEN x THEN x END)) FROM (SELECT (SELECT sum(CAST(a IN(SELECT (SELECT max(x)OVER(ORDER BY CASE x WHEN 889 THEN 299 WHEN 863 THEN 863 END)) FROM (SELECT (SELECT sum(CAST((SELECT (SELECT max(x)OVER(ORDER BY x) / min(x)OVER(ORDER BY CASE x WHEN 889 THEN 299 WHEN -true THEN 863 END)) FROM (SELECT (SELECT sum(CAST(a IN(SELECT (SELECT max(x) & sum ( a )OVER(ORDER BY CASE x WHEN -8 THEN 299 WHEN 863 THEN 863 END)) FROM (SELECT (SELECT sum(CAST(a AS )) FROM t1) AS x FROM t1)) AS t1 )) FROM t1) AS x FROM t1)) AS x )) FROM t1) AS x FROM t1)) AS real)) FROM t1) AS x FROM t1)
;
which reduces to
SELECT sum(CAST(a AS )) FROM t1
I've been fuzzing the parser and fixed a common cause of panic in https://github.com/tursodatabase/libsql/pull/1209
If the fix suits you, open a PR here.