#4118 closed defect (fixed)

Memory sanitizer warnings

Reported by: Algunenano Owned by: Algunenano
Priority: medium Milestone: PostGIS 2.5.0
Component: postgis Version: trunk
Keywords: Cc:

Description

Running liblwgeom with Clang's memory sanitizer (-fsanitize=memory -fsanitize-memory-track-origins=2 -fsanitize-recover=memory) currently throws almost 40k errors.

  • Postgis version: svn-trunk
  • Geos version: 3.7.0beta1.r4

The idea with this ticket is to start addressing those warnings so hopefully this sanitizer can be used to detect possible bugs in the future as with -fsanitize=address or -fsanitize=undefined.

Change History (2)

comment:1 Changed 16 months ago by Raul Marin

In 16638:

Clean memory sanitizer warnings

References #4118
Closes https://github.com/postgis/postgis/pull/265

comment:2 Changed 15 months ago by Algunenano

Resolution: fixed
Status: assignedclosed

The only pending warnings are related to json-c (cu_in_geojson.c) and one that looks like an issue in GEOS:

Suite: geometry_clean
  Test: test_lwgeom_make_valid ...Uninitialized bytes in __interceptor_memcmp at offset 0 inside [0x7ffe9a5bc230, 256)
==11015==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f3e496ef4cc in std::ctype<char>::_M_widen_init() const /build/gcc/src/gcc/libstdc++-v3/src/c++11/ctype.cc:98:25
    #1 0x7f3e4974d208 in std::ctype<char>::widen(char) const /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:876:21
    #2 0x7f3e4974d208 in std::basic_ios<char, std::char_traits<char> >::widen(char) const /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_ios.h:450:49
    #3 0x7f3e4974d208 in std::basic_ios<char, std::char_traits<char> >::fill() const /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_ios.h:374:14
    #4 0x7f3e4974d208 in std::ostream& std::ostream::_M_insert<double>(double) /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/ostream.tcc:73:49
    #5 0x7f3e49bf215c in geos::geom::operator<<(std::ostream&, geos::geom::Coordinate const&) /home/raul/dev/PKGBUILDs/geos-git/src/geos/src/geom/Coordinate.cpp:51:6
    #6 0x7f3e49bf2086 in geos::geom::Coordinate::toString[abi:cxx11]() const /home/raul/dev/PKGBUILDs/geos-git/src/geos/src/geom/Coordinate.cpp:43:29
    #7 0x7f3e49d1a679 in geos::operation::valid::TopologyValidationError::toString[abi:cxx11]() /home/raul/dev/PKGBUILDs/geos-git/src/geos/src/operation/valid/TopologyValidationError.cpp:83:61
    #8 0x7f3e4b66b858 in GEOSisValid_r /home/raul/dev/PKGBUILDs/geos-git/src/geos/capi/geos_ts_c.cpp:939:46
    #9 0x7f3e4b66622f in GEOSisValid /home/raul/dev/PKGBUILDs/geos-git/src/geos/capi/geos_c.cpp:242:12
    #10 0x7f3e4bb2821a in LWGEOM_GEOS_makeValid /home/raul/dev/public/postgis/liblwgeom/lwgeom_geos_clean.c:711:13
    #11 0x7f3e4bb2b53e in lwgeom_make_valid /home/raul/dev/public/postgis/liblwgeom/lwgeom_geos_clean.c:888:12
    #12 0x556972fae6b4 in test_lwgeom_make_valid /home/raul/dev/public/postgis/liblwgeom/cunit/cu_clean.c:55:9
    #13 0x7f3e4b437117  (/usr/lib/libcunit.so.1+0x4117)
    #14 0x7f3e4b4373b1  (/usr/lib/libcunit.so.1+0x43b1)
    #15 0x7f3e4b4377b6 in CU_run_all_tests (/usr/lib/libcunit.so.1+0x47b6)
    #16 0x556973060757 in main /home/raul/dev/public/postgis/liblwgeom/cunit/cu_tester.c:177:13
    #17 0x7f3e4a4c306a in __libc_start_main (/usr/lib/libc.so.6+0x2306a)
    #18 0x556972f24db9 in _start (/home/raul/dev/public/postgis/liblwgeom/cunit/.libs/lt-cu_tester+0x24db9)

  Uninitialized value was created by an allocation of 'yyvsa' in the stack frame of function 'wkt_yyparse'
    #0 0x7f3e4b9c7580 in wkt_yyparse /home/raul/dev/public/postgis/liblwgeom/lwin_wkt_parse.c:1634

SUMMARY: MemorySanitizer: use-of-uninitialized-value /build/gcc/src/gcc/libstdc++-v3/src/c++11/ctype.cc:98:25 in std::ctype<char>::_M_widen

I'm closing this for now. At some point in the future I'll try to look into these and report them upstream.

Note: See TracTickets for help on using tickets.