/ View Ticket
Login
Ticket Hash: 5829597ac43811e35d9fccd9b1f3b852ab6f713f
Title: SEGV in sqlite3.c:80685 sqlite3VdbeCursorMoveto
Status: Fixed Type: Code_Defect
Severity: Important Priority: Low
Subsystem: Unknown Resolution: Fixed
Last Modified: 2020-03-22 03:20:08
Version Found In:
User Comments:
yongheng added on 2020-03-21 20:46:23:
POC:
---
CREATE TABLE v0(v4 UNIQUE AS(v3), v2, v3);
INSERT INTO v0(v2) VALUES(0);
CREATE VIEW v5(v6) AS SELECT v4 FROM v0;
SELECT 0 FROM v5 GROUP BY v6;
---

It triggers a segmentation fault in release version of sqlite3.

drh added on 2020-03-21 22:17:54:

We are unable to verify the claim in the initial report that this problem exists in a release version of SQLite. The POC script runs to completion and generates the correct answer on SQLite versions 3.31.0 and 3.31.1. The POC script uses features (generated columns) that were unavailable in earlier versions of SQLite.

The POC does fail in the latest (unreleased) trunk version of SQLite. The error seems to have been was introduced less than 24 hours ago by check-in [a9bb71ba708ba722].


yongheng added on 2020-03-22 02:34:13:
I tested on the following version, so I thought it would exist on the release version of sqlite.

~: ./sqlite3
SQLite version 3.31.0 2019-11-17 02:41:06
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> CREATE TABLE v0(v4 UNIQUE AS(v3), v2, v3);
sqlite> INSERT INTO v0(v2) VALUES(0);
sqlite> CREATE VIEW v5(v6) AS SELECT v4 FROM v0;
sqlite> SELECT 0 FROM v5 GROUP BY v6;
[1]    48773 segmentation fault (core dumped)  ./sqlite3

drh added on 2020-03-22 03:20:08:

That's a bad assumption. There are 314 check-ins on the path from the version you tested to the 3.31.0 release.

https://sqlite.org/src/timeline?from=1e449687881f4d38&to=version-3.31.0

Here is a bisect going from the version you tested to version 3.31.0, showing the exact check-in where the problem was originally fixed:

https://sqlite.org/src/timeline?bid=n1e44968...