Skip to content

Commit bf7c1d5

Browse files
committed
Validate cached icon indices before remapping
1 parent 1384d4e commit bf7c1d5

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎Src/StartMenu/StartMenuDLL/ItemManager.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3337,19 +3337,19 @@ void CItemManager::LoadCacheFile( void )
33373337
info.iconColor=data.iconColor;
33383338
info.iconIndex=data.iconIndex;
33393339

3340-
info.smallIcon=data.smallIcon<(int)remapIcons.size()?remapIcons[data.smallIcon]:NULL;
3340+
info.smallIcon=data.smallIcon>=0 && (size_t)data.smallIcon<remapIcons.size()?remapIcons[data.smallIcon]:NULL;
33413341
if (!info.smallIcon)
33423342
{
33433343
info.validFlags&=~INFO_SMALL_ICON;
33443344
info.smallIcon=m_DefaultSmallIcon;
33453345
}
3346-
info.largeIcon=data.largeIcon<(int)remapIcons.size()?remapIcons[data.largeIcon]:NULL;
3346+
info.largeIcon=data.largeIcon>=0 && (size_t)data.largeIcon<remapIcons.size()?remapIcons[data.largeIcon]:NULL;
33473347
if (!info.largeIcon)
33483348
{
33493349
info.validFlags&=~INFO_LARGE_ICON;
33503350
info.largeIcon=m_DefaultLargeIcon;
33513351
}
3352-
info.extraLargeIcon=data.extraLargeIcon<(int)remapIcons.size()?remapIcons[data.extraLargeIcon]:NULL;
3352+
info.extraLargeIcon=data.extraLargeIcon>=0 && (size_t)data.extraLargeIcon<remapIcons.size()?remapIcons[data.extraLargeIcon]:NULL;
33533353
if (!info.extraLargeIcon)
33543354
{
33553355
info.validFlags&=~INFO_EXTRA_LARGE_ICON;

0 commit comments

Comments
 (0)