-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory sanitizer warnings in GeometryFactory.cpp #129
Conversation
Suite: buildarea
Test: buildarea1 ...Uninitialized bytes in __interceptor_memcmp at offset 0 inside [0x7fffae24fa80, 4)
==19345==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x7f5ed6768c5f in std::char_traits<char>::compare(char const*, char const*, unsigned long) /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/char_traits.h:310:25
libgeos#1 0x7f5ed6768c5f in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:1424:37
libgeos#2 0x7f5ed6892f40 in bool std::operator==<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*) /usr/include/c++/8.2.1/bits/basic_string.h:6075:35
libgeos#3 0x7f5ed6892f40 in geos::geom::GeometryFactory::buildGeometry(std::vector<geos::geom::Geometry*, std::allocator<geos::geom::Geometry*> >*) const /usr/src/debug/geos/src/geom/GeometryFactory.cpp:664:16
libgeos#4 0x7f5ed690dd48 in geos::operation::overlay::OverlayOp::computeOverlay(geos::operation::overlay::OverlayOp::OpCode) /usr/src/debug/geos/src/operation/overlay/OverlayOp.cpp:839:28
libgeos#5 0x7f5ed690dee1 in geos::operation::overlay::OverlayOp::getResultGeometry(geos::operation::overlay::OverlayOp::OpCode) /usr/src/debug/geos/src/operation/overlay/OverlayOp.cpp:187:16
libgeos#6 0x7f5ed690e281 in geos::operation::overlay::OverlayOp::overlayOp(geos::geom::Geometry const*, geos::geom::Geometry const*, geos::operation::overlay::OverlayOp::OpCode) /usr/src/debug/geos/src/operation/overlay/OverlayOp.cpp:93:30
libgeos#7 0x7f5ed688d11f in geos::operation::overlay::overlayOp::operator()(geos::geom::Geometry const*, geos::geom::Geometry const*) /usr/src/debug/geos/src/geom/../../include/geos/operation/overlay/OverlayOp.h:388:44
libgeos#8 0x7f5ed688d11f in std::unique_ptr<geos::geom::Geometry, std::default_delete<geos::geom::Geometry> > geos::geom::BinaryOp<geos::operation::overlay::overlayOp>(geos::geom::Geometry const*, geos::geom::Geometry const*, geos::operation::overlay::overlayOp) /usr/src/debug/geos/src/geom/../../include/geos/geom/BinaryOp.h:357:3
libgeos#9 0x7f5ed688b16f in geos::geom::Geometry::Union(geos::geom::Geometry const*) const /usr/src/debug/geos/src/geom/Geometry.cpp:586:17
libgeos#10 0x7f5ed691885d in geos::operation::geounion::CascadedPolygonUnion::unionActual(geos::geom::Geometry*, geos::geom::Geometry*) /usr/src/debug/geos/src/operation/union/CascadedPolygonUnion.cpp:370:36
libgeos#11 0x7f5ed6919080 in geos::operation::geounion::CascadedPolygonUnion::unionOptimized(geos::geom::Geometry*, geos::geom::Geometry*) /usr/src/debug/geos/src/operation/union/CascadedPolygonUnion.cpp:236:27
libgeos#12 0x7f5ed6919252 in geos::operation::geounion::CascadedPolygonUnion::unionTree(geos::index::strtree::ItemsList*) /usr/src/debug/geos/src/operation/union/CascadedPolygonUnion.cpp:162:23
libgeos#13 0x7f5ed6919630 in geos::operation::geounion::CascadedPolygonUnion::Union() /usr/src/debug/geos/src/operation/union/CascadedPolygonUnion.cpp:151:21
libgeos#14 0x7f5ed691983d in geos::operation::geounion::CascadedPolygonUnion::Union(geos::geom::MultiPolygon const*) /usr/src/debug/geos/src/operation/union/CascadedPolygonUnion.cpp:124:20
libgeos#15 0x7f5ed71db6a8 in GEOSUnionCascaded_r /usr/src/debug/geos/capi/geos_ts_c.cpp:2497:43
libgeos#16 0x7f5ed7332ed6 in LWGEOM_GEOS_buildArea /home/raul/dev/public/postgis/liblwgeom/lwgeom_geos.c:1124:8
libgeos#17 0x7f5ed7333164 in lwgeom_buildarea /home/raul/dev/public/postgis/liblwgeom/lwgeom_geos.c:1155:7
libgeos#18 0x55b755e00bfa in buildarea1 /un/dev_public/postgis/liblwgeom/cunit/cu_buildarea.c:66:9
libgeos#19 0x7f5ed6fb1117 (/usr/lib/libcunit.so.1+0x4117)
libgeos#20 0x7f5ed6fb13b1 (/usr/lib/libcunit.so.1+0x43b1)
libgeos#21 0x7f5ed6fb17b6 in CU_run_all_tests (/usr/lib/libcunit.so.1+0x47b6)
libgeos#22 0x55b755e7f6b7 in main /un/dev_public/postgis/liblwgeom/cunit/cu_tester.c:177:13
libgeos#23 0x7f5ed6c3c222 in __libc_start_main (/usr/lib/libc.so.6+0x24222)
libgeos#24 0x55b755d7f0bd in _start (/un/dev_public/postgis/liblwgeom/cunit/.libs/lt-cu_tester+0x250bd)
SUMMARY: MemorySanitizer: use-of-uninitialized-value /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/char_traits.h:310:25 in std::char_traits<char>::compare(char const*, char const*, unsigned long)
|
Trac issue created in https://trac.osgeo.org/geos/ticket/929 |
|
I don't exactly understand the issue here, but it seems like the code could be using the integer type for each geometry and avoiding the string compares altogether. |
ed32137
to
2182415
Compare
|
I've rewritten it to use the GeometryTypeId instead of |
|
Cherry-picked into master |
|
I'm getting warnings on winnie after this commit because the catchall return was changed to an assert(0). https://trac.osgeo.org/geos/ticket/942
|
I'm not getting any warnings with either gcc 8.2.1 or clang 7.0. It seems that the compiler back then wasn't able to understand it won't be able to reach that point, so it's probably generating that code path too. Just to be safe I'd add back |
|
OK, did this at 3d81f71 |
This gets rids of a memory sanitizer warning when running Postgis unit tests (trunk) against Geos 3.7.
I've only built and tested this against 3.7. Let me know if you need the extra PRs