Fix heap corruption with cursor pixel counts that aren't divisible by 8
This commit is contained in:
parent
f5dd0d4eaf
commit
7cdd156bce
1 changed files with 2 additions and 2 deletions
|
|
@ -234,7 +234,7 @@ namespace platf::dxgi {
|
|||
auto xor_mask = std::begin(img_data) + bytes;
|
||||
|
||||
for (auto x = 0; x < bytes; ++x) {
|
||||
for (auto c = 7; c >= 0; --c) {
|
||||
for (auto c = 7; c >= 0 && ((std::uint8_t *) pixel_data) != std::end(cursor_img); --c) {
|
||||
auto bit = 1 << c;
|
||||
auto color_type = ((*and_mask & bit) ? 1 : 0) + ((*xor_mask & bit) ? 2 : 0);
|
||||
|
||||
|
|
@ -307,7 +307,7 @@ namespace platf::dxgi {
|
|||
auto xor_mask = std::begin(img_data) + bytes;
|
||||
|
||||
for (auto x = 0; x < bytes; ++x) {
|
||||
for (auto c = 7; c >= 0; --c) {
|
||||
for (auto c = 7; c >= 0 && ((std::uint8_t *) pixel_data) != std::end(cursor_img); --c) {
|
||||
auto bit = 1 << c;
|
||||
auto color_type = ((*and_mask & bit) ? 1 : 0) + ((*xor_mask & bit) ? 2 : 0);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue