[USER32] Fix uninitialized cbTotal

CORE-18025
This commit is contained in:
Katayama Hirofumi MZ 2022-01-26 08:14:59 +09:00
parent f8faa0b660
commit 1cad26ad08

View file

@ -532,17 +532,10 @@ static UINT ICO_ExtractIconExW(
cbColorTable = (1 << bi.biBitCount) * sizeof(RGBTRIPLE); cbColorTable = (1 << bi.biBitCount) * sizeof(RGBTRIPLE);
} }
} }
#else
entry = (LPICONIMAGE)(imageData);
#endif
if(sig == 2)
{
#ifdef __REACTOS__
/* biSizeImage is the size of the raw bitmap data. /* biSizeImage is the size of the raw bitmap data.
* A dummy 0 can be given for BI_RGB bitmaps.
* https://en.wikipedia.org/wiki/BMP_file_format */ * https://en.wikipedia.org/wiki/BMP_file_format */
if (bi.biSizeImage == 0 || bi.biSize == sizeof(BITMAPCOREHEADER)) if (bi.biSizeImage == 0)
{ {
/* Calculate image size */ /* Calculate image size */
#define WIDTHBYTES(width, bits) (((width) * (bits) + 31) / 32 * 4) #define WIDTHBYTES(width, bits) (((width) * (bits) + 31) / 32 * 4)
@ -550,9 +543,15 @@ static UINT ICO_ExtractIconExW(
bi.biSizeImage += WIDTHBYTES(bi.biWidth, 1) * (bi.biHeight / 2); bi.biSizeImage += WIDTHBYTES(bi.biWidth, 1) * (bi.biHeight / 2);
#undef WIDTHBYTES #undef WIDTHBYTES
} }
/* Calculate total size */ /* Calculate total size */
cbTotal = bi.biSize + cbColorTable + bi.biSizeImage; cbTotal = bi.biSize + cbColorTable + bi.biSizeImage;
#else
entry = (LPICONIMAGE)(imageData);
#endif #endif
if(sig == 2)
{
/* we need to prepend the bitmap data with hot spots for CreateIconFromResourceEx */ /* we need to prepend the bitmap data with hot spots for CreateIconFromResourceEx */
#ifdef __REACTOS__ #ifdef __REACTOS__
cursorData = HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(WORD) + cbTotal); cursorData = HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(WORD) + cbTotal);