File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ``` toml
2+ [advisory ]
3+ id = " RUSTSEC-0000-0000"
4+ package = " yottadb"
5+ date = " 2021-02-09"
6+ url = " https://gitlab.com/YottaDB/Lang/YDBRust/-/issues/40"
7+ categories = [" memory-corruption" ]
8+ keywords = [" use-after-free" ]
9+
10+ [versions ]
11+ patched = [" >= 1.2.0" ]
12+
13+ [affected .functions ]
14+ "yottadb::Key::sub_next_self_st" = [" < 1.2.0" ]
15+ "yottadb::Key::sub_prev_self_st" = [" < 1.2.0" ]
16+ "yottadb::KeyContext::sub_next_self_st" = [" < 1.2.0" ]
17+ "yottadb::KeyContext::sub_prev_self_st" = [" < 1.2.0" ]
18+ ```
19+
20+ # Use-after-free in ` subscript_next ` and ` subscript_prev ` wrappers
21+
22+ Affected versions of this crate had an unsound implementation which could pass
23+ a pointer to freed memory to ` ydb_subscript_next_st ` and
24+ ` ydb_subscript_prev_st ` if the variable and subscripts did not have enough
25+ memory allocated on the first call to hold the next variable in the database.
26+
27+ For example, the following code had undefined behavior:
28+
29+ ``` rust
30+ let mut key = Key :: variable (String :: from (" a" ));
31+ Key :: variable (" averylongkeywithlotsofletters" )
32+ . set_st (YDB_NOTTP , Vec :: new (), b " some val" )
33+ . unwrap ();
34+ key . sub_next_self_st (YDB_NOTTP , Vec :: new ()). unwrap ();
35+ ```
36+
37+ ` yottadb ` has no reverse-dependencies on crates.io and there are no known
38+ instances of this API being used incorrectly in practice. The fix is backwards
39+ compatible.
40+
41+ The flaw was corrected by recalculating the pointer each time it was reallocated.
You can’t perform that action at this time.
0 commit comments