google / google/leveldb

Comparator::Compare() has no way to signal corruption

Open
#749 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
39.4k
Forks
8.2k
PR merge metrics
No merged PRs in 30d

Description

The API for `leveldb::Comparator::Compare()` has no provision for failure. Failure is a reasonable response when one of the inputs is not a valid application key. Assuming no bugs in LevelDB, this can happen if on-disk keys are corrupted.

Example: suppose the on-disk key is a pair of strings, encoded as varint(length of string 1) | string1 | string 2. An input of `0x05 0x01` is then invalid -- s1's length is 5, but the key only has one more byte.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.