1
0
mirror of synced 2024-11-25 00:00:27 +01:00

fix: Vector out of bounds access

This commit is contained in:
WerWolv 2022-06-13 21:56:02 +02:00
parent f243ac7464
commit a5d202ffc8
2 changed files with 18 additions and 16 deletions

@ -1 +1 @@
Subproject commit 31ae5773b099cb48cdd81bc8b6c01e6da94fe672
Subproject commit 55324f345e955bdc8ba23b32feeae31acbbc3ffc

View File

@ -655,24 +655,26 @@ namespace hex::plugin::builtin {
const auto cellBytes = std::min<u64>(validBytes, bytesPerCell);
// Query cell colors
const auto foregroundColor = queryForegroundColor(byteAddress, &bytes[x], cellBytes);
const auto backgroundColor = [&]{
auto color = queryBackgroundColor(byteAddress, &bytes[x], cellBytes);
if (x < validBytes) {
const auto foregroundColor = queryForegroundColor(byteAddress, &bytes[x], cellBytes);
const auto backgroundColor = [&]{
auto color = queryBackgroundColor(byteAddress, &bytes[x], cellBytes);
if ((byteAddress >= selectionMin && byteAddress <= selectionMax)) {
if (color.has_value())
color = ((ImAlphaBlendColors(color.value(), this->m_selectionColor)) & 0x00FFFFFF) | (this->m_selectionColor & 0xFF000000);
else
color = this->m_selectionColor;
}
if ((byteAddress >= selectionMin && byteAddress <= selectionMax)) {
if (color.has_value())
color = ((ImAlphaBlendColors(color.value(), this->m_selectionColor)) & 0x00FFFFFF) | (this->m_selectionColor & 0xFF000000);
else
color = this->m_selectionColor;
}
return color;
}();
return color;
}();
cellColors.emplace_back(
foregroundColor,
backgroundColor
);
cellColors.emplace_back(
foregroundColor,
backgroundColor
);
}
}
}