Skip to content

Commit

Permalink
Windows: Fix heap overflow setting native icon
Browse files Browse the repository at this point in the history
  • Loading branch information
jordo committed Jan 23, 2023
1 parent ae47e1d commit 86945ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion platform/windows/os_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3105,7 +3105,7 @@ void OS_Windows::set_native_icon(const String &p_filename) {
pos += sizeof(WORD);
f->seek(pos);

icon_dir = (ICONDIR *)memrealloc(icon_dir, 3 * sizeof(WORD) + icon_dir->idCount * sizeof(ICONDIRENTRY));
icon_dir = (ICONDIR *)memrealloc(icon_dir, sizeof(ICONDIR) + (icon_dir->idCount * sizeof(ICONDIRENTRY)));
f->get_buffer((uint8_t *)&icon_dir->idEntries[0], icon_dir->idCount * sizeof(ICONDIRENTRY));

int small_icon_index = -1; // Select 16x16 with largest color count
Expand Down

0 comments on commit 86945ff

Please sign in to comment.