img.Attach((HBITMAP)LoadImage(hInstance, MAKEINTRESOURCE(nIDResource), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION), ATL::CImage::DIBOR_TOPDOWN);
const int nWidth = img.GetWidth();
const int nHeight= img.GetHeight();
- const int stride = (nWidth * 4 * 4 + 3) / 4; std::vector<BYTE> buf(stride * nHeight);
+ const int stride = (nWidth * 4 * 4 + 3) / 4;
+ std::vector<BYTE> buf(static_cast<size_t>(stride) * nHeight);
switch (img.GetBPP())
{
case 24:
bi.bmiHeader.biClrUsed = 0;
bi.bmiHeader.biClrImportant = 0;
- buf = (pBGR) malloc(nx * 4 * ny);
+ buf = (pBGR) malloc(static_cast<size_t>(nx) * 4 * ny);
nRes = GetDIBits(hdcSrc, hBmpSrc, 0, ny, buf, &bi, DIB_RGB_COLORS);
if (nRes == 0) {
free(buf);
CDC dc;
dc.CreateCompatibleDC(pDC);
bmp.Create(m_iconX, -m_iconY, 32, CImage::createAlphaChannel);
- memset(bmp.GetBits(), 0xff, abs(bmp.GetPitch()) * m_iconY);
+ memset(bmp.GetBits(), 0xff, static_cast<size_t>(abs(bmp.GetPitch())) * m_iconY);
HGDIOBJ pOldBmp = dc.SelectObject(bmp.operator HBITMAP());
POINT pt = {0};
SIZE sz = {m_iconX, m_iconY};