diff options
| author | luigi1111 <luigi1111w@gmail.com> | 2020-07-08 17:07:50 -0500 |
|---|---|---|
| committer | luigi1111 <luigi1111w@gmail.com> | 2020-07-08 17:07:50 -0500 |
| commit | 35e2520115835463c55840912d2dc0f89e32ab97 (patch) | |
| tree | 7ac452c205e9fcd43fdfff9be1622cc6da308a2b /contrib/epee/src | |
| parent | ee817e00bbdc3be73a93980f07cf1d6145f95640 (diff) | |
| parent | 15538f7e3f8fdafb13b99554a8726850caeef937 (diff) | |
| download | monzero-core-35e2520115835463c55840912d2dc0f89e32ab97.tar.gz monzero-core-35e2520115835463c55840912d2dc0f89e32ab97.tar.xz monzero-core-35e2520115835463c55840912d2dc0f89e32ab97.zip | |
Merge pull request #6559
15538f7 ByteSlice: Fix persisting ptr to std::moved SSO buffer (Doy-lee)
Diffstat (limited to 'contrib/epee/src')
| -rw-r--r-- | contrib/epee/src/byte_slice.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/epee/src/byte_slice.cpp b/contrib/epee/src/byte_slice.cpp index 12cc83e6c..faf7689be 100644 --- a/contrib/epee/src/byte_slice.cpp +++ b/contrib/epee/src/byte_slice.cpp @@ -133,10 +133,13 @@ namespace epee template<typename T> byte_slice::byte_slice(const adapt_buffer, T&& buffer) - : storage_(nullptr), portion_(to_byte_span(to_span(buffer))) + : storage_(nullptr), portion_(nullptr) { if (!buffer.empty()) + { storage_ = allocate_slice<adapted_byte_slice<T>>(0, std::move(buffer)); + portion_ = to_byte_span(to_span(static_cast<adapted_byte_slice<T> *>(storage_.get())->buffer)); + } } byte_slice::byte_slice(std::initializer_list<span<const std::uint8_t>> sources) |
