-
Notifications
You must be signed in to change notification settings - Fork 704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raw iterator segfaults when user forgets to seek before calling next
#824
Comments
Atomic loading a null 0x0 address? Looks like a rocksdb bug. Does this occur if testing with c++ rocksdb of the same version? |
@athre0z good catch 👍🏻 |
In cpp I've got the same result: #include <rocksdb/db.h>
using namespace rocksdb;
int main() {
DB *db = nullptr;
Options options;
options.create_if_missing = true;
auto status = DB::Open(options, "/tmp/dddd", &db);
assert(status.ok());
auto iter = db->NewIterator(ReadOptions());
iter->Next();
return 0;
} Result:
|
Hmm, yeah. The C++ I suppose the problem here might simply be that in a C++ API it is typically considered to be perfectly acceptable for something to segfault if a user disregards such requirements whereas in Rust it would be considered unsound for a function that isn't marked as I suspect that the Rust interface for the raw iterator might have to be changed to automatically perform |
Valid call seems very cheap, just returning a flag: https://github.com/facebook/rocksdb/blob/543191f2eacadf14e3aa6ff9a08f85a8ad82da95/db/db_iter.h#L144 |
Originally tested with v0.21.0 but also repros with
master
.Add this test case to
tests/test_raw_iterator.rs
:The text was updated successfully, but these errors were encountered: