Skip to content

Commit 102fad0

Browse files
authored
Merge pull request #769 from jyn514/ydbrust
Add use-after-free advisory for `yottadb 1.1.0` and earlier
2 parents c5ebb27 + 8b06817 commit 102fad0

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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.

0 commit comments

Comments
 (0)