axmol: AddressSanitizer find bugs in axmol engine
- axmol version: https://github.com/axmolengine/axmol/commit/4e664e6681457d653c88e072c0ef30bcceac77e6
- devices test on: Windows 10
- developing environments
- NDK version: r19c
- Xcode version: 12.4
- Visual Studio:
- VS version: 2022 (17.6.3)
- MSVC version: 1929, 1934
- Windows SDK version: 10.0.22621.0
- cmake version: 3.25.2 Steps to Reproduce: Windows, Visual studio 2022
- Enable adress sanitizer for VS https://learn.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-170 by adding on the top of to CMakeLists.txt
add_compile_options(/fsanitize=address)
- build and start cpp-test
- Press “Start AutoTest”
- After some time application crashed with
Sample errors:
- ActionsProgressTests Address Sanitizer Error: Use of out-of-scope stack memory
void ProgressTimer::updateColor()
{
if (!_sprite)
return;
if (!_vertexData.empty())
{
const Color4B& sc = _sprite->getQuad().tl.colors;
for (int i = 0; i < _vertexData.size(); ++i)
{
_vertexData[i].colors = sc;
}
}
}
- TextureCacheUnbindTest Address Sanitizer Error: Use of deallocated memory
// release the asyncStruct
delete asyncStruct;
--_asyncRefCount;
Comments: This kind of problems means that we are in undefined behavior zone and can not reason about program correctness. This kind of issue could result in the problems seen in https://github.com/axmolengine/axmol/issues/1211
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 21 (18 by maintainers)
const V3F_C4B_T2F_Quad& getQuad() const {
is best