8000 potential out of bounds read · ggml-org/llama.cpp@c67e5ef · GitHub
[go: up one dir, main page]

Skip to content

Commit c67e5ef

Browse files
committed
potential out of bounds read
1 parent 5ae5e2c commit c67e5ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ struct llama_tokenizer {
324324
while (!text.empty()) {
325325
llama_sp_symbol sym;
326326
size_t char_len = utf8_len(text.data()[0]);
327-
sym.text = std::string_view(text.data(), char_len);
327+
sym.text = std::string_view(text.data(), std::min(text.size(), char_len));
328328
sym.prev = index - 1;
329329
text.remove_prefix(char_len);
330330
sym.next = text.empty() ? -1 : index + 1;

0 commit comments

Comments
 (0)
0