Fix Slice underflow.
This commit is contained in:
parent
083d599c41
commit
add28462a0
@ -628,7 +628,7 @@ static vector<Slice> match_urls(Slice str) {
|
||||
}
|
||||
path_end_ptr = next_ptr;
|
||||
}
|
||||
while (bad_path_end_chars.find(path_end_ptr[-1]) < bad_path_end_chars.size()) {
|
||||
while (path_end_ptr > url_end_ptr + 1 && bad_path_end_chars.find(path_end_ptr[-1]) < bad_path_end_chars.size()) {
|
||||
path_end_ptr--;
|
||||
}
|
||||
if (url_end_ptr[0] == '/' || path_end_ptr > url_end_ptr + 1) {
|
||||
|
@ -582,6 +582,7 @@ TEST(MessageEntities, url) {
|
||||
check_url("https://t…", {});
|
||||
check_url("👉http://ab.com/cdefgh-1IJ", {"http://ab.com/cdefgh-1IJ"});
|
||||
check_url("...👉http://ab.com/cdefgh-1IJ", {}); // TODO
|
||||
check_url(".?", {});
|
||||
}
|
||||
|
||||
static void check_fix_formatted_text(td::string str, td::vector<td::MessageEntity> entities,
|
||||
|
Loading…
Reference in New Issue
Block a user