Harden dynamic HTTP and compiler boundaries
This commit is contained in:
@@ -140,6 +140,8 @@ bool contains(String haystack, String needle)
|
||||
|
||||
String replace(String s, String search, String replace_with)
|
||||
{
|
||||
if(search == "")
|
||||
return(s);
|
||||
s64 last_spos = 0;
|
||||
auto spos = s.find(search);
|
||||
if(spos == std::string::npos)
|
||||
@@ -791,7 +793,7 @@ DValue array_merge(DValue a, DValue b)
|
||||
StringList split_utf8(String s, bool compound_characters)
|
||||
{
|
||||
StringList result;
|
||||
auto len = s.size();
|
||||
s64 len = (s64)s.size();
|
||||
String codepoint = "";
|
||||
for(s64 i = 0; i < len; i++)
|
||||
{
|
||||
@@ -800,13 +802,13 @@ StringList split_utf8(String s, bool compound_characters)
|
||||
{
|
||||
codepoint = "";
|
||||
codepoint.append(1, c);
|
||||
if(is_bit_set(c, 6))
|
||||
if(is_bit_set(c, 6) && i + 1 < len)
|
||||
{
|
||||
codepoint.append(1, s[++i]);
|
||||
if(is_bit_set(c, 5))
|
||||
if(is_bit_set(c, 5) && i + 1 < len)
|
||||
{
|
||||
codepoint.append(1, s[++i]);
|
||||
if(is_bit_set(c, 4))
|
||||
if(is_bit_set(c, 4) && i + 1 < len)
|
||||
{
|
||||
codepoint.append(1, s[++i]);
|
||||
}
|
||||
@@ -837,7 +839,7 @@ StringList split_utf8(String s, bool compound_characters)
|
||||
join_next = true;
|
||||
last_was_regional = false;
|
||||
}
|
||||
else if(s[0] == '\xF0' && s[1] == '\x9F' && s[2] == '\x87' && s[3] >= '\xA6' && s[3] <= '\xBF') // Regional indicator letters
|
||||
else if(s.size() == 4 && s[0] == '\xF0' && s[1] == '\x9F' && s[2] == '\x87' && s[3] >= '\xA6' && s[3] <= '\xBF') // Regional indicator letters
|
||||
{
|
||||
if(last_was_regional)
|
||||
{
|
||||
@@ -850,7 +852,7 @@ StringList split_utf8(String s, bool compound_characters)
|
||||
last_was_regional = true;
|
||||
}
|
||||
}
|
||||
else if(s[0] == '\xEF' && s[1] == '\xB8' && s[2] >= '\x80' && s[2] <= '\x8F') // Variation selector
|
||||
else if(s.size() == 3 && s[0] == '\xEF' && s[1] == '\xB8' && s[2] >= '\x80' && s[2] <= '\x8F') // Variation selector
|
||||
{
|
||||
compound_result[compound_result.size()-1] += s;
|
||||
last_was_regional = false;
|
||||
|
||||
Reference in New Issue
Block a user