I cannot edit the description, so the SRU template is below. Please copy
it into the description and sponsor the attached debdiff. This is the
first time I provide such a patch on launchpad, so please do let me know
whether I should change anything.

[Impact]
On noble, libsqlite3 segfaults while preparing valid SQL with nested 
parenthesized joins. The package is built with SQLITE_ALLOW_ROWID_IN_VIEW, 
which triggers an upstream bug in SQLite 3.44.2 to 3.45.2, fixed in 3.45.3. 
Later Ubuntu releases already ship the fix. The SQLAlchemy and Diesel test 
suites hit it.

[Test Plan]
Run:
/usr/bin/python3 -c "import sqlite3; 
sqlite3.connect(':memory:').executescript('CREATE TABLE users (id INTEGER 
PRIMARY KEY, name TEXT); CREATE TABLE posts (id INTEGER PRIMARY KEY, user_id 
INTEGER); CREATE TABLE comments (id INTEGER PRIMARY KEY, post_id INTEGER); 
CREATE TABLE likes (comment_id INTEGER, user_id INTEGER); CREATE TABLE 
followings (user_id INTEGER, post_id INTEGER); SELECT users.id FROM (users 
INNER JOIN ((posts LEFT OUTER JOIN (comments LEFT OUTER JOIN likes ON 
(likes.comment_id = comments.id)) ON (comments.post_id = posts.id)) LEFT OUTER 
JOIN followings ON (followings.post_id = posts.id)) ON (posts.user_id = 
users.id));'); print('ok')"
Before: "Segmentation fault". After: prints "ok".

[Where problems could occur]
The patch changes how "rowid" is resolved in views and subqueries. Visible 
effects, all matching SQLite 3.45.3:
- some invalid rowid references now say "ambiguous column name: rowid" instead 
of "no such column: rowid"
- SELECT rowid FROM (SELECT 1), t now returns the rowid of t instead of an error
- "rowid IS NULL" on a view now returns the matching rows instead of none

[Other Info]
Upstream fix https://sqlite.org/src/info/7a3d0027f81e8def, backported without 
its new sqlite3_config() option, so the API is unchanged. Bug 2161638 is a 
duplicate.

** Patch added: "Debdiff for noble attached. It backports the upstream fix from 
SQLite 3.45.3. I built and tested it on noble. The test plan no longer crashes, 
and the upstream test suite shows no new failures. Please sponsor."
   
https://bugs.launchpad.net/ubuntu/+source/sqlite3/+bug/2087772/+attachment/6002010/+files/sqlite3_3_45_1_1ubuntu2.debdiff

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2087772

Title:
  crash (segfault) in libsqlite3 running multi-join query

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/sqlite3/+bug/2087772/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to