Fix invalid memory use bug in DBString
MODIFY
src/dbarray.cpp
src/dbarray.cpp
namespace lcf {
-constexpr DBArrayAlloc::size_type DBArrayAlloc::_empty_buf;
+constexpr DBArrayAlloc::size_type DBArrayAlloc::_empty_buf[2];
constexpr DBString::size_type DBString::npos;
static ptrdiff_t HeaderSize(size_t align) {

MODIFY
src/lcf/dbarrayalloc.h
src/lcf/dbarrayalloc.h
@@ -27,7 +27,7 @@ struct DBArrayAlloc {
static void free(void* p, size_type align) noexcept;
static constexpr void* empty_buf() {
- return const_cast<size_type*>(&_empty_buf + 1);
+ return const_cast<size_type*>(&_empty_buf[1]);
}
static constexpr size_type* get_size_ptr(void* p) {
@@ -39,7 +39,7 @@ struct DBArrayAlloc {
}
private:
- static constexpr const size_type _empty_buf = 0;
+ static constexpr const size_type _empty_buf[2] = { 0, 0 };
};
} // namespace lcf

Fix invalid memory use bug in DBString