Fix ICO_ExtractIconExW causing explorer to crash when trying

to display icon for bad EXE PE header.

See CORE-15879

 Co-authored-by: Thomas Faber <thomas.faber@reactos.org>
This commit is contained in:
Doug Lyons 2023-02-26 13:03:53 -06:00 committed by Timo Kreuzer
parent 781fb4a55e
commit 60851914a8

View file

@ -616,6 +616,15 @@ static UINT ICO_ExtractIconExW(
goto end;
}
#ifdef __REACTOS__
/* Check for boundary limit (and overflow) */
if (((ULONG_PTR)(rootresdir + 1) < (ULONG_PTR)rootresdir) ||
((ULONG_PTR)(rootresdir + 1) > (ULONG_PTR)peimage + fsizel))
{
goto end;
}
#endif
/* search for the group icon directory */
if (!(icongroupresdir = find_entry_by_id(rootresdir, LOWORD(RT_GROUP_ICON), rootresdir)))
{