Skip to content

Commit

Permalink
Merge pull request #76 from CommitteeOfZero/hotfix/charset_flags_oob
Browse files Browse the repository at this point in the history
Fix oob issue on charset and change to vector so we get oob assertion…
  • Loading branch information
KKhanhH authored Oct 16, 2024
2 parents e0bb8b7 + b978e1c commit 47ea372
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion profiles/cclcc/charset.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ for p, c in utf8.codes(charsetStr) do
i = i + 1
end

for i = 0, (64 * 117) - 1 do root.Charset.Flags[i] = 0; end
for i = 0, (64 * 125) - 1 do root.Charset.Flags[i] = 0; end

local spaces = {[0]=0, 63};
for i = 0, #spaces do
Expand Down
2 changes: 1 addition & 1 deletion src/profile/charset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void Load() {
EnsurePushMemberOfType("Flags", LUA_TTABLE);

uint32_t flagsCount = (uint32_t)lua_rawlen(LuaState, -1);
Flags = (uint8_t*)malloc(flagsCount + 1);
Flags.resize(flagsCount + 1);
PushInitialIndex();
while (PushNextTableElement() != 0) {
int i = EnsureGetKeyInt();
Expand Down
2 changes: 1 addition & 1 deletion src/profile/charset.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Impacto {
namespace Profile {
namespace Charset {

inline uint8_t *Flags = nullptr;
inline std::vector<uint8_t> Flags;
inline ska::flat_hash_map<uint32_t, uint16_t> CharacterToSc3;

void Load();
Expand Down

0 comments on commit 47ea372

Please sign in to comment.