File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ ``` toml
2
+ [advisory ]
3
+ id = " RUSTSEC-0000-0000"
4
+ package = " diesel"
5
+ date = " 2021-03-05"
6
+ url = " https://github.com/diesel-rs/diesel/pull/2663"
7
+ categories = [" memory-corruption" ]
8
+ keywords = [" use after free" ]
9
+
10
+ [affected ]
11
+ functions = { "diesel::SqliteConnection::query_by_name" = [" < 1.4.6" ] }
12
+ [versions ]
13
+ patched = [" >= 1.4.6" ]
14
+ ```
15
+
16
+ # Fix a use-after-free bug in diesels Sqlite backend
17
+
18
+ We've misused ` sqlite3_column_name ` . The
19
+ [ SQLite] ( https://www.sqlite.org/c3ref/column_name.html ) documentation
20
+ states that the following:
21
+
22
+ > The returned string pointer is valid until either the prepared statement
23
+ > is destroyed by sqlite3_finalize() or until the statement is automatically
24
+ > reprepared by the first call to sqlite3_step() for a particular
25
+ > run or until the next call to sqlite3_column_name()
26
+ > or sqlite3_column_name16() on the same column.
27
+
28
+ As part of our ` query_by_name ` infrastructure we've first received all
29
+ field names for the prepared statement and stored them as string slices
30
+ for later use. After that we called ` sqlite3_step() ` for the first time,
31
+ which invalids the pointer and therefore the stored string slice.
You can’t perform that action at this time.
0 commit comments