Skip to content

Commit 0f2ca27

Browse files
authored
Add files via upload
1 parent 94722d4 commit 0f2ca27

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

common/chat.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2031,6 +2031,10 @@ static void common_chat_parse_glm_4_5(common_chat_msg_parser & builder) {
20312031
gen_partial_args([&](auto &&rest, auto &&needle){arguments[rest + needle] = "";});
20322032
throw common_chat_msg_partial_exception("Expected </arg_key> after <arg_key>");
20332033
}
2034+
if (key_res->groups[0].end - key_res->groups[0].begin != 10) {
2035+
gen_partial_args([&](auto &&rest, auto &&needle){arguments[key_res->prelude + needle] = "";});
2036+
throw common_chat_msg_partial_exception("Expected </arg_key> after <arg_key>");
2037+
}
20342038
auto &key = key_res->prelude;
20352039
builder.consume_spaces();
20362040

@@ -2070,6 +2074,10 @@ static void common_chat_parse_glm_4_5(common_chat_msg_parser & builder) {
20702074
// If not, parse as plain text
20712075
if (val_start == builder.pos()) {
20722076
if (auto value_plain = builder.try_find_literal("</arg_value>")) {
2077+
if (value_plain->groups[0].end - value_plain->groups[0].begin != 12) {
2078+
gen_partial_args([&](auto &&rest, auto &&needle){arguments[key] = value_plain->prelude + needle;});
2079+
throw common_chat_msg_partial_exception("Expected </arg_value> after <arg_value>");
2080+
}
20732081
arguments[key] = value_plain->prelude;
20742082
} else {
20752083
gen_partial_args([&](auto &&rest, auto &&needle){arguments[key] = rest + needle;});

0 commit comments

Comments
 (0)