Unexpectedly truncate destination string inside Footer::EncodeTo()
- Dominant language
- C++
- Stars
- 39.4k
- Forks
- 8.2k
- PR merge metrics
- No merged PRs in 30d
Description
Here is the original code snippet from the master branch.
https://github.com/google/leveldb/blob/fb644cb44539925a7f444b1b0314f402a456c5f4/table/format.cc#L31-L40
Should L35 be the following instead? And L39 can then be eliminated. The original code truncates destination string unexpectedly.
```cpp
dst->resize(original_size + 2 * BlockHandle::kMaxEncodedLength); // Padding
```
Anyway, `Footer` class is NOT an API exported by LevelDB. And the only usage of this class I found is: https://github.com/google/leveldb/blob/fb644cb44539925a7f444b1b0314f402a456c5f4/table/table_builder.cc#L246
Therefore, I think this issue is NOT vital. It only confuses readers.
I can create PR if it is welcomed.
Contributor guide
Assessment
This issue has not been assessed yet.