1.Problem Description
When running controls.exe, the colorpicker window opens; the program crashes。
The vs2019 debug output window displays the following error message
HEAP CORRUPTION DETECTED: after Normal block (#706823) at 0x08A84EB0.
CRT detected that the application wrote to memory after end of heap buffer.
2.Cause of the bug
In the GetMousePosBitmap function of the ColorPicker.cpp file,
pDestPixelBits[++destColorIndex] = pPixelBits[colorXY];
the access subscript of ++destColorIndex starts at 1, so pDestPixelBits will be written out of bounds; it crashes when released; the problem is solved after changing to
pDestPixelBits[destColorIndex++] = pPixelBits[colorXY];
1.Problem Description When running controls.exe, the colorpicker window opens; the program crashes。 The vs2019 debug output window displays the following error message
2.Cause of the bug In the GetMousePosBitmap function of the ColorPicker.cpp file,
pDestPixelBits[++destColorIndex] = pPixelBits[colorXY];
the access subscript of ++destColorIndex starts at 1, so pDestPixelBits will be written out of bounds; it crashes when released; the problem is solved after changing topDestPixelBits[destColorIndex++] = pPixelBits[colorXY];