mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Fix invalid-read to freed memory in ttl-iterator
Summary: value function in ttl-iterator was returning string which would have been freed before its usage as a slice. Thanks valgrind! Test Plan: valgrind ./ttl_test Reviewers: dhruba, haobo, sheki, vamsi Reviewed By: haobo CC: leveldb Differential Revision: https://reviews.facebook.net/D10635
This commit is contained in:
@@ -54,7 +54,9 @@ class TtlIterator : public Iterator {
|
||||
|
||||
Slice value() const {
|
||||
assert(iter_->value().size() >= (unsigned)ts_len_);
|
||||
return std::string(iter_->value().data(), iter_->value().size() - ts_len_);
|
||||
Slice trimmed_value = iter_->value();
|
||||
trimmed_value.size_ -= ts_len_;
|
||||
return trimmed_value;
|
||||
}
|
||||
|
||||
Status status() const {
|
||||
|
||||
Reference in New Issue
Block a user