Skip to content

Commit 8be048e

Browse files
committed
feat(silo): better checks before applying memcpy
1 parent 712589a commit 8be048e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/silo/common/german_string.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ class GermanString {
5252
GermanString(length_type length, std::string_view prefix, suffix_id_type suffix_offset) {
5353
SILO_ASSERT(length > SHORT_STRING_SIZE);
5454
SILO_ASSERT(prefix.size() == PREFIX_LENGTH);
55+
SILO_ASSERT(PREFIX_START + PREFIX_LENGTH <= data.size());
56+
SILO_ASSERT(SUFFIX_ID_START + sizeof(suffix_id_type) <= data.size());
5557
*reinterpret_cast<length_type*>(data.data()) = length;
5658
std::memcpy(data.data() + PREFIX_START, prefix.data(), PREFIX_LENGTH);
5759
*reinterpret_cast<suffix_id_type*>(data.data() + SUFFIX_ID_START) = suffix_offset;

0 commit comments

Comments
 (0)