(text/x-fossil-wiki)
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:
<blockquote><verbatim>
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;
</verbatim></blockquote>
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 [https://github.com/google/oss-fuzz|OSSFuzz].
|