-
Notifications
You must be signed in to change notification settings - Fork 157
Description
I compiled UVAtlas with GNU 13.2.0 and I got some Wstringop-overflow warnings:
C:/msys64/home/jpmugaas/uvatlas-PKGBUILD/src/uvatlas-oct2023/UVAtlas/isochart/meshapplyisomap.cpp: In member function 'HRESULT Isochart::CIsochartMesh::CalculateGeodesicDistanceToVertexKS98(uint32_t, bool, uint32_t*) const':
C:/msys64/home/jpmugaas/uvatlas-PKGBUILD/src/uvatlas-oct2023/UVAtlas/isochart/meshapplyisomap.cpp:565:11: warning: 'void* memset(void*, int, size_t)' specified size between 9223372036854775809 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
565 | memset(pbVertProcessed.get(), 0, sizeof(bool) * m_dwVertNumber);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[20/25] Building CXX object CMakeFiles/UVAtlas.dir/UVAtlas/isochart/isochartmesh.cpp.obj
C:/msys64/home/jpmugaas/uvatlas-PKGBUILD/src/uvatlas-oct2023/UVAtlas/isochart/isochartmesh.cpp: In member function 'HRESULT Isochart::CIsochartMesh::CalculateDijkstraPathToVertex(uint32_t, uint32_t*) const':
C:/msys64/home/jpmugaas/uvatlas-PKGBUILD/src/uvatlas-oct2023/UVAtlas/isochart/isochartmesh.cpp:3350:11: warning: 'void* memset(void*, int, size_t)' specified size between 9223372036854775809 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
3350 | memset(pbVertProcessed, 0, sizeof(bool) * m_dwVertNumber);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From the GCC manual:
Warn for calls to string manipulation functions such as memcpy and strcpy that are determined to overflow the destination buffer. The optional argument is one greater than the type of Object Size Checking to perform to determine the size of the destination. See Object Size Checking. The argument is meaningful only for functions that operate on character arrays but not for raw memory functions like memcpy which always make use of Object Size type-0. The option also warns for calls that specify a size in excess of the largest possible object or at most SIZE_MAX / 2 bytes. The option produces the best results with optimization enabled but can detect a small subset of simple buffer overflows even without optimization in calls to the GCC built-in functions like __builtin_memcpy that correspond to the standard functions. In any case, the option warns about just a subset of buffer overflows detected by the corresponding overflow checking built-ins.