Skip to content

Commit

Permalink
Fix some sanitizer errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lhmouse committed Feb 15, 2024
1 parent fa66993 commit 1c9b5ac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
12 changes: 8 additions & 4 deletions asteria/library/string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1402,8 +1402,10 @@ std_string_url_encode(V_string data)
continue;

// Escape it.
pseq[1] = s_base16_table[(c >> 3) & 0x1E];
pseq[2] = s_base16_table[(c << 1) & 0x1E];
uint32_t hi = static_cast<uint32_t>((c & 0xF0) >> 3);
uint32_t lo = static_cast<uint32_t>((c & 0x0F) << 1);
pseq[1] = s_base16_table[hi];
pseq[2] = s_base16_table[lo];
text.replace(nread - 1, 1, pseq, 3);
nread += 2;
}
Expand Down Expand Up @@ -1478,8 +1480,10 @@ std_string_url_query_encode(V_string data)
}

// Escape it.
pseq[1] = s_base16_table[(c >> 3) & 0x1E];
pseq[2] = s_base16_table[(c << 1) & 0x1E];
uint32_t hi = static_cast<uint32_t>((c & 0xF0) >> 3);
uint32_t lo = static_cast<uint32_t>((c & 0x0F) << 1);
pseq[1] = s_base16_table[hi];
pseq[2] = s_base16_table[lo];
text.replace(nread - 1, 1, pseq, 3);
nread += 2;
}
Expand Down
3 changes: 2 additions & 1 deletion asteria/llds/avm_rod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ clear() noexcept
}

#ifdef ROCKET_DEBUG
::memset(this->m_bptr, 0xE6, this->m_estor * sizeof(Header));
if(this->m_bptr)
::memset(this->m_bptr, 0xE6, this->m_estor * sizeof(Header));
#endif
this->m_einit = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion asteria/runtime/air_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ do_apply_binary_operator_with_integer(uint8_t uxop, Value& lhs, V_integer irhs)
"Arithmetic left shift overflow (operands were `$1` and `$2`)",
lhs, irhs);

val <<= count;
reinterpret_cast<uint64_t&>(val) <<= count;
return air_status_next;
}

Expand Down

0 comments on commit 1c9b5ac

Please sign in to comment.