Hi,
The bug
A statement like this SELECT * FROM abc INNER JOIN xyz USING (*) results in a segmentation fault. But SELECT * FROM abc JOIN xyz USING (id) parses successfully. The parser does not seem to like the * in the USING.
This was found using grammar-based fuzzing.
How it was found, if you think that is fun :)
I am doing some analysis of grammar-based fuzzy testing for my master's thesis. For this I used AFL++ and created a grammar for SQL, which AFL++ then uses for its tests. Part of the grammar can be seen here. The highlights are a path to an SQL statement that crashes the parser:

(1) We start from <START> and go to <STATEMENTS>.
(2) Here it can only go to <STATEMENT> (singular)
(3) Here it has multiple options. For the crash-statement, it takes the <SELECT>
(4) Now it takes the <SELECT> with the <JOIN_CLAUSE>
(5) Here it takes the one with "USING"
(6) It takes the one with the * and goes to <COLUMNS_1>
(7) Here it takes the empty one
This could result in the following statement: SELECT v AS Y6 FROM b INNER JOIN pB USING (* );, which gives a segmentation fault.
Hi,
The bug
A statement like this
SELECT * FROM abc INNER JOIN xyz USING (*)results in a segmentation fault. ButSELECT * FROM abc JOIN xyz USING (id)parses successfully. The parser does not seem to like the*in theUSING.This was found using grammar-based fuzzing.
How it was found, if you think that is fun :)
I am doing some analysis of grammar-based fuzzy testing for my master's thesis. For this I used AFL++ and created a grammar for SQL, which AFL++ then uses for its tests. Part of the grammar can be seen here. The highlights are a path to an SQL statement that crashes the parser:

(1) We start from
<START>and go to<STATEMENTS>.(2) Here it can only go to
<STATEMENT>(singular)(3) Here it has multiple options. For the crash-statement, it takes the
<SELECT>(4) Now it takes the
<SELECT>with the<JOIN_CLAUSE>(5) Here it takes the one with "USING"
(6) It takes the one with the
*and goes to<COLUMNS_1>(7) Here it takes the empty one
This could result in the following statement:
SELECT v AS Y6 FROM b INNER JOIN pB USING (* );, which gives a segmentation fault.