Incorrect Lifetime Bounds on Closures in `rusqlite`
High severity
GitHub Reviewed
Published
Jun 17, 2022
to the GitHub Advisory Database
•
Updated Jun 13, 2023
Package
Affected versions
>= 0.26.0, < 0.26.2
>= 0.25.0, < 0.25.4
Patched versions
0.26.2
0.25.4
Description
Published to the GitHub Advisory Database
Jun 17, 2022
Reviewed
Jun 17, 2022
Last updated
Jun 13, 2023
The lifetime bound on several closure-accepting
rusqlite
functions (specifically, functions which register a callback to be later invoked by SQLite) was too relaxed. If a closure referencing borrowed values on the stack is was passed to one of these functions, it could allow Rust code to access objects on the stack after they have been dropped.The impacted functions are:
cfg(feature = "functions")
:Connection::create_scalar_function
,Connection::create_aggregate_function
andConnection::create_window_function
.cfg(feature = "hooks")
:Connection::commit_hook
,Connection::rollback_hook
andConnection::update_hook
.cfg(feature = "collation")
:Connection::create_collation
.The issue exists in all
0.25.*
versions prior to0.25.4
, and all0.26.*
versions prior to 0.26.2 (specifically:0.25.0
,0.25.1
,0.25.2
,0.25.3
,0.26.0
, and0.26.1
).The fix is available in versions
0.26.2
and newer, and also has been back-ported to0.25.4
. As it does not exist in0.24.*
, all affected versions should have an upgrade path to a semver-compatible release.References