|Title:||Assertion fault following PRAGMA reverse_unordered_selects=ON|
|Last Modified:||2017-08-01 19:53:54|
|Version Found In:||3.20.0|
drh added on 2017-08-01 18:21:15:
When assert()s are enabled (which is to say when SQLite is compiled using -DSQLITE_DEBUG) the following SQL causes an assertion fault in the byte-code engine:
PRAGMA reverse_unordered_selects=on; CREATE TABLE t1(a,b); INSERT INTO t1 VALUES(1,2); CREATE INDEX t1b ON t1(b); SELECT a FROM t1 WHERE b=-99 OR b>1;
Bisecting shows that this bug was introduced with check-in [663473850c] on 2016-11-15 and first appeared in release 3.16.0. As far as we can determine at this time, the bug is harmless in the sense that SQLite functions normally and computes the correct answer when assert()s are disabled. However, the assertion fault does indicate that the logic is confused and needs to be refactored for long-term maintainability.
This problem was discovered by OSSFuzz.