jsonnet icon indicating copy to clipboard operation
jsonnet copied to clipboard

Memory sanitizer reports use-of-uninitialized-value

Open CareF opened this issue 2 years ago • 0 comments

on master, runs:

CC=clang bazel run //cmd:jsonnet --copt=-fsanitize=memory --copt=-g --copt=-fsanitize-memory-track-origins --linkopt=-fsanitize=memory

it shows:

$ CC=clang bazel run //cmd:jsonnet --copt=-fsanitize=memory --copt=-g --copt=-fsanitize-memory-track-origins --linkopt=-fsanitize=memory                                               130 master
WARNING: Stripping enabled, but '--copt=-g' (or --per_file_copt=...@-g) specified. Debug information will be generated and then stripped away. This is probably not what you want! Use '-c dbg' for debug mode, or use '--strip=never' to disable stripping
INFO: Analyzed target //cmd:jsonnet (7 packages loaded, 125 targets configured).
INFO: Found 1 target...
Target //cmd:jsonnet up-to-date:
  bazel-bin/cmd/jsonnet
INFO: Elapsed time: 5.392s, Critical Path: 5.26s
INFO: 5 processes: 1 internal, 4 linux-sandbox.
INFO: Build completed successfully, 5 total actions
INFO: Build completed successfully, 5 total actions
==443669==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x3da1b3 in std::_Rb_tree<BinaryOp, std::pair<BinaryOp const, int>, std::_Select1st<std::pair<BinaryOp const, int> >, std::less<BinaryOp>, std::allocator<std::pair<BinaryOp const, int> > >::_M_lower_bound(std::_Rb_tree_node<std::pair<BinaryOp const, int> >*, std::_Rb_tree_node_base*, BinaryOp const&) (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3da1b3)
    #1 0x3d9c00 in std::_Rb_tree<BinaryOp, std::pair<BinaryOp const, int>, std::_Select1st<std::pair<BinaryOp const, int> >, std::less<BinaryOp>, std::allocator<std::pair<BinaryOp const, int> > >::lower_bound(BinaryOp const&) (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3d9c00)
    #2 0x3d724b in std::map<BinaryOp, int, std::less<BinaryOp>, std::allocator<std::pair<BinaryOp const, int> > >::lower_bound(BinaryOp const&) (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3d724b)
    #3 0x3d61ac in std::map<BinaryOp, int, std::less<BinaryOp>, std::allocator<std::pair<BinaryOp const, int> > >::operator[](BinaryOp&&) (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3d61ac)
    #4 0x3a6935 in (anonymous namespace)::build_precedence_map() (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3a6935)
    #5 0x3ce871 in __cxx_global_var_init.1 (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3ce871)
    #6 0x3ce9cd in _GLOBAL__sub_I_libjsonnet.cpp (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3ce9cd)
    #7 0xdc5bec in __libc_csu_init (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0xdc5bec)
    #8 0x7f763491900f in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:264:6
    #9 0x2cf14d in _start (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x2cf14d)

  Uninitialized value was stored to memory at
    #0 0x3da56a in std::_Rb_tree<BinaryOp, std::pair<BinaryOp const, int>, std::_Select1st<std::pair<BinaryOp const, int> >, std::less<BinaryOp>, std::allocator<std::pair<BinaryOp const, int> > >::_M_lower_bound(std::_Rb_tree_node<std::pair<BinaryOp const, int> >*, std::_Rb_tree_node_base*, BinaryOp const&) (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3da56a)
    #1 0x3d9c00 in std::_Rb_tree<BinaryOp, std::pair<BinaryOp const, int>, std::_Select1st<std::pair<BinaryOp const, int> >, std::less<BinaryOp>, std::allocator<std::pair<BinaryOp const, int> > >::lower_bound(BinaryOp const&) (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3d9c00)
    #2 0x3d724b in std::map<BinaryOp, int, std::less<BinaryOp>, std::allocator<std::pair<BinaryOp const, int> > >::lower_bound(BinaryOp const&) (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3d724b)
    #3 0x3d61ac in std::map<BinaryOp, int, std::less<BinaryOp>, std::allocator<std::pair<BinaryOp const, int> > >::operator[](BinaryOp&&) (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3d61ac)
    #4 0x3a6935 in (anonymous namespace)::build_precedence_map() (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3a6935)
    #5 0x3ce871 in __cxx_global_var_init.1 (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3ce871)
    #6 0x3ce9cd in _GLOBAL__sub_I_libjsonnet.cpp (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3ce9cd)
    #7 0xdc5bec in __libc_csu_init (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0xdc5bec)

  Uninitialized value was created by a heap allocation
    #0 0x2db32d in malloc (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x2db32d)
    #1 0x7f7634be1b38 in operator new(unsigned long) (/lib/x86_64-linux-gnu/libstdc++.so.6+0xaab38)
    #2 0x3e02e2 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<BinaryOp const, int> > > >::allocate(std::allocator<std::_Rb_tree_node<std::pair<BinaryOp const, int> > >&, unsigned long) (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3e02e2)
    #3 0x3df669 in std::_Rb_tree<BinaryOp, std::pair<BinaryOp const, int>, std::_Select1st<std::pair<BinaryOp const, int> >, std::less<BinaryOp>, std::allocator<std::pair<BinaryOp const, int> > >::_M_get_node() (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3df669)
    #4 0x3dc136 in std::_Rb_tree_node<std::pair<BinaryOp const, int> >* std::_Rb_tree<BinaryOp, std::pair<BinaryOp const, int>, std::_Select1st<std::pair<BinaryOp const, int> >, std::less<BinaryOp>, std::allocator<std::pair<BinaryOp const, int> > >::_M_create_node<std::piecewise_construct_t const&, std::tuple<BinaryOp&&>, std::tuple<> >(std::piecewise_construct_t const&, std::tuple<BinaryOp&&>&&, std::tuple<>&&) (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3dc136)
    #5 0x3d8966 in std::_Rb_tree_iterator<std::pair<BinaryOp const, int> > std::_Rb_tree<BinaryOp, std::pair<BinaryOp const, int>, std::_Select1st<std::pair<BinaryOp const, int> >, std::less<BinaryOp>, std::allocator<std::pair<BinaryOp const, int> > >::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<BinaryOp&&>, std::tuple<> >(std::_Rb_tree_const_iterator<std::pair<BinaryOp const, int> >, std::piecewise_construct_t const&, std::tuple<BinaryOp&&>&&, std::tuple<>&&) (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3d8966)
    #6 0x3d68fd in std::map<BinaryOp, int, std::less<BinaryOp>, std::allocator<std::pair<BinaryOp const, int> > >::operator[](BinaryOp&&) (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3d68fd)
    #7 0x3a681e in (anonymous namespace)::build_precedence_map() (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3a681e)
    #8 0x3ce871 in __cxx_global_var_init.1 (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3ce871)
    #9 0x3ce9cd in _GLOBAL__sub_I_libjsonnet.cpp (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3ce9cd)
    #10 0xdc5bec in __libc_csu_init (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0xdc5bec)

SUMMARY: MemorySanitizer: use-of-uninitialized-value (/home/user/.cache/bazel/_bazel_lm/0a20c32ccfa12a781a6f752899a01c4f/execroot/jsonnet/bazel-out/k8-fastbuild/bin/cmd/jsonnet+0x3da1b3) in std::_Rb_tree<BinaryOp, std::pair<BinaryOp const, int>, std::_Select1st<std::pair<BinaryOp const, int> >, std::less<BinaryOp>, std::allocator<std::pair<BinaryOp const, int> > >::_M_lower_bound(std::_Rb_tree_node<std::pair<BinaryOp const, int> >*, std::_Rb_tree_node_base*, BinaryOp const&)
Exiting


tested under Ubuntu 20.04.5 with bazel 5.3.0 & clang 10.0.0

CareF avatar Sep 23 '22 06:09 CareF