{"action":"opened","number":56,"pull_request":{"url":"https://api.github.com/repos/riebl/artery/pulls/56","id":234989526,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM0OTg5NTI2","html_url":"https://github.com/riebl/artery/pull/56","diff_url":"https://github.com/riebl/artery/pull/56.diff","patch_url":"https://github.com/riebl/artery/pull/56.patch","issue_url":"https://api.github.com/repos/riebl/artery/issues/56","number":56,"state":"open","locked":false,"title":"LocalEnvironmentModel: fix stack-use-after-scope","user":{"login":"hagau","id":28601035,"node_id":"MDQ6VXNlcjI4NjAxMDM1","avatar_url":"https://avatars1.githubusercontent.com/u/28601035?v=4","gravatar_id":"","url":"https://api.github.com/users/hagau","html_url":"https://github.com/hagau","followers_url":"https://api.github.com/users/hagau/followers","following_url":"https://api.github.com/users/hagau/following{/other_user}","gists_url":"https://api.github.com/users/hagau/gists{/gist_id}","starred_url":"https://api.github.com/users/hagau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hagau/subscriptions","organizations_url":"https://api.github.com/users/hagau/orgs","repos_url":"https://api.github.com/users/hagau/repos","events_url":"https://api.github.com/users/hagau/events{/privacy}","received_events_url":"https://api.github.com/users/hagau/received_events","type":"User","site_admin":false},"body":"We have this pretty simple code snippet:\r\n```\r\nauto const& radarObjects = filterBySensorCategory(mLocalEnvironmentModel->allObjects(), \"Radar\");\r\nTrackedObjects LEMObjectsCurrentStates;\r\nfor (auto& obj : radarObjects) {\r\n    LEMObjectsCurrentStates.insert(obj);\r\n}\r\n```\r\nresulting in this:\r\n```\r\nERROR: AddressSanitizer: stack-use-after-scope on address 0x7fffeaca9ca8 at pc 0x7ffff7bd2144 bp 0x7fffffff27b0 sp 0x7fffffff27a8\r\nREAD of size 8 at 0x7fffeaca9ca8 thread T0\r\n    #0 0x7ffff7bd2143 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/basic_string.h:922:16\r\n    #1 0x7ffff7bd2143 in __gnu_cxx::__enable_if<__is_char<char>::__value, bool>::__type std::operator==<char>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/basic_string.h:6049\r\n    #2 0x7fffda125638 in artery::filterBySensorCategory(std::map<std::weak_ptr<artery::EnvironmentModelObject>, artery::LocalEnvironmentModel::Tracking, std::owner_less<std::weak_ptr<artery::EnvironmentModelObject> >, std::allocator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)::$_0::operator()(std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&) const::'lambda'(std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> const&)::operator()(std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> const&) const /home/artery/artery/src/artery/envmod/LocalEnvironmentModel.cc:196:56\r\n    #3 0x7fffda125638 in bool __gnu_cxx::__ops::_Iter_pred<artery::filterBySensorCategory(std::map<std::weak_ptr<artery::EnvironmentModelObject>, artery::LocalEnvironmentModel::Tracking, std::owner_less<std::weak_ptr<artery::EnvironmentModelObject> >, std::allocator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)::$_0::operator()(std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&) const::'lambda'(std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> const&)>::operator()<std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> > >(std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> >) /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/predefined_ops.h:283\r\n    #4 0x7fffda125638 in std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> > std::__find_if<std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> >, __gnu_cxx::__ops::_Iter_pred<artery::filterBySensorCategory(std::map<std::weak_ptr<artery::EnvironmentModelObject>, artery::LocalEnvironmentModel::Tracking, std::owner_less<std::weak_ptr<artery::EnvironmentModelObject> >, std::allocator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)::$_0::operator()(std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&) const::'lambda'(std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> const&)> >(std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> >, std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> >, __gnu_cxx::__ops::_Iter_pred<artery::filterBySensorCategory(std::map<std::weak_ptr<artery::EnvironmentModelObject>, artery::LocalEnvironmentModel::Tracking, std::owner_less<std::weak_ptr<artery::EnvironmentModelObject> >, std::allocator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)::$_0::operator()(std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&) const::'lambda'(std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> const&)>, std::input_iterator_tag) /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/stl_algo.h:104\r\n    #5 0x7fffda124da6 in std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> > std::__find_if<std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> >, __gnu_cxx::__ops::_Iter_pred<artery::filterBySensorCategory(std::map<std::weak_ptr<artery::EnvironmentModelObject>, artery::LocalEnvironmentModel::Tracking, std::owner_less<std::weak_ptr<artery::EnvironmentModelObject> >, std::allocator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)::$_0::operator()(std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&) const::'lambda'(std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> const&)> >(std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> >, std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> >, __gnu_cxx::__ops::_Iter_pred<artery::filterBySensorCategory(std::map<std::weak_ptr<artery::EnvironmentModelObject>, artery::LocalEnvironmentModel::Tracking, std::owner_less<std::weak_ptr<artery::EnvironmentModelObject> >, std::allocator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)::$_0::operator()(std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&) const::'lambda'(std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> const&)>) /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/stl_algo.h:161:14\r\n    #6 0x7fffda124da6 in std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> > std::find_if<std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> >, artery::filterBySensorCategory(std::map<std::weak_ptr<artery::EnvironmentModelObject>, artery::LocalEnvironmentModel::Tracking, std::owner_less<std::weak_ptr<artery::EnvironmentModelObject> >, std::allocator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)::$_0::operator()(std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&) const::'lambda'(std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> const&)>(std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> >, std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> >, artery::filterBySensorCategory(std::map<std::weak_ptr<artery::EnvironmentModelObject>, artery::LocalEnvironmentModel::Tracking, std::owner_less<std::weak_ptr<artery::EnvironmentModelObject> >, std::allocator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)::$_0::operator()(std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&) const::'lambda'(std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> const&)) /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/stl_algo.h:3930\r\n    #7 0x7fffda124da6 in bool std::none_of<std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> >, artery::filterBySensorCategory(std::map<std::weak_ptr<artery::EnvironmentModelObject>, artery::LocalEnvironmentModel::Tracking, std::owner_less<std::weak_ptr<artery::EnvironmentModelObject> >, std::allocator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)::$_0::operator()(std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&) const::'lambda'(std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> const&)>(std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> >, std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> >, artery::filterBySensorCategory(std::map<std::weak_ptr<artery::EnvironmentModelObject>, artery::LocalEnvironmentModel::Tracking, std::owner_less<std::weak_ptr<artery::EnvironmentModelObject> >, std::allocator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)::$_0::operator()(std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&) const::'lambda'(std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> const&)) /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/stl_algo.h:526\r\n    #8 0x7fffda124da6 in bool std::any_of<std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> >, artery::filterBySensorCategory(std::map<std::weak_ptr<artery::EnvironmentModelObject>, artery::LocalEnvironmentModel::Tracking, std::owner_less<std::weak_ptr<artery::EnvironmentModelObject> >, std::allocator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)::$_0::operator()(std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&) const::'lambda'(std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> const&)>(std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> >, std::_Rb_tree_const_iterator<std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> >, artery::filterBySensorCategory(std::map<std::weak_ptr<artery::EnvironmentModelObject>, artery::LocalEnvironmentModel::Tracking, std::owner_less<std::weak_ptr<artery::EnvironmentModelObject> >, std::allocator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)::$_0::operator()(std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&) const::'lambda'(std::pair<artery::Sensor const* const, artery::LocalEnvironmentModel::TrackingTime> const&)) /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/stl_algo.h:544\r\n    #9 0x7fffda124da6 in artery::filterBySensorCategory(std::map<std::weak_ptr<artery::EnvironmentModelObject>, artery::LocalEnvironmentModel::Tracking, std::owner_less<std::weak_ptr<artery::EnvironmentModelObject> >, std::allocator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)::$_0::operator()(std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&) const /home/artery/artery/src/artery/envmod/LocalEnvironmentModel.cc:192\r\n    #10 0x7fffda124da6 in std::_Function_handler<bool (std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&), artery::filterBySensorCategory(std::map<std::weak_ptr<artery::EnvironmentModelObject>, artery::LocalEnvironmentModel::Tracking, std::owner_less<std::weak_ptr<artery::EnvironmentModelObject> >, std::allocator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)::$_0>::_M_invoke(std::_Any_data const&, std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&) /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/std_function.h:282\r\n    #11 0x7fffda139dc2 in boost::iterators::filter_iterator<std::function<bool (std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&)>, std::_Rb_tree_const_iterator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > >::satisfy_predicate() /usr/include/boost/iterator/filter_iterator.hpp:100:50\r\n    #12 0x7fffda1a7df7 in void boost::iterators::iterator_core_access::increment<boost::iterators::filter_iterator<std::function<bool (std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&)>, std::_Rb_tree_const_iterator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > > >(boost::iterators::filter_iterator<std::function<bool (std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&)>, std::_Rb_tree_const_iterator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > >&) /usr/include/boost/iterator/iterator_facade.hpp:556:13\r\n    #13 0x7fffda1a7df7 in boost::iterators::detail::iterator_facade_base<boost::iterators::filter_iterator<std::function<bool (std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&)>, std::_Rb_tree_const_iterator<std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> > >, std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking>, boost::iterators::bidirectional_traversal_tag, std::pair<std::weak_ptr<artery::EnvironmentModelObject> const, artery::LocalEnvironmentModel::Tracking> const&, long, false, false>::operator++() /usr/include/boost/iterator/iterator_facade.hpp:666\r\n    #14 0x7fffd86f56c3 in artery::CpService::getPocCandidates[abi:cxx11](unsigned short, omnetpp::SimTime const&) /home/artery/artery/src/artery/application/cpservice/CpService.cc:379:17\r\n    #15 0x7fffd86ebeff in artery::CpService::generateCollectivePerceptionMessage(omnetpp::SimTime const&) /home/artery/artery/src/artery/application/cpservice/CpService.cc:669:42\r\n    #16 0x7fffd86eb9ac in artery::CpService::checkTriggeringConditions(omnetpp::SimTime const&) /home/artery/artery/src/artery/application/cpservice/CpService.cc:163:3\r\n    #17 0x7fffd86eb5fe in artery::CpService::trigger() /home/artery/artery/src/artery/application/cpservice/CpService.cc:156:2\r\n    #18 0x7fffdf30b3b4 in artery::Middleware::updateServices() /home/artery/artery/src/artery/application/Middleware.cc:174:19\r\n    #19 0x7fffdf30ae8b in artery::Middleware::update() /home/artery/artery/src/artery/application/Middleware.cc:161:5\r\n    #20 0x7ffff5af7370 in omnetpp::cSimulation::executeEvent(omnetpp::cEvent*) /home/artery/omnetpp-5.4.1/src/sim/csimulation.cc:611:13\r\n    #21 0x7ffff7fa095f in omnetpp::cmdenv::Cmdenv::simulate() /home/artery/omnetpp-5.4.1/src/cmdenv/cmdenv.cc:401:34\r\n    #22 0x7ffff7f9b730 in omnetpp::cmdenv::Cmdenv::doRun() /home/artery/omnetpp-5.4.1/src/cmdenv/cmdenv.cc:261:17\r\n    #23 0x7ffff7b79d2a in omnetpp::envir::EnvirBase::run() /home/artery/omnetpp-5.4.1/src/envir/envirbase.cc:742:9\r\n    #24 0x7ffff7b6b86f in omnetpp::envir::EnvirBase::run(int, char**, omnetpp::cConfiguration*) /home/artery/omnetpp-5.4.1/src/envir/envirbase.cc:354:13\r\n    #25 0x7ffff7b52f90 in omnetpp::envir::setupUserInterface(int, char**) /home/artery/omnetpp-5.4.1/src/envir/startup.cc:259:29\r\n    #26 0x7ffff7b5595f in evMain /home/artery/omnetpp-5.4.1/src/envir/evmain.cc:33:20\r\n    #27 0x7ffff32f14ea in __libc_start_main /var/tmp/portage/sys-libs/glibc-2.28-r2/work/glibc-2.28/csu/../csu/libc-start.c:308:16\r\n    #28 0x41c2f9 in _start (/home/artery/omnetpp-5.4.1/bin/opp_run_dbg+0x41c2f9)\r\n\r\nAddress 0x7fffeaca9ca8 is located in stack of thread T0 at offset 168 in frame\r\n    #0 0x7fffd86f531f in artery::CpService::getPocCandidates[abi:cxx11](unsigned short, omnetpp::SimTime const&) /home/artery/artery/src/artery/application/cpservice/CpService.cc:376\r\n\r\n  This frame has 10 object(s):\r\n    [32, 128) 'ref.tmp' (line 377)\r\n    [160, 192) 'ref.tmp13' (line 377) <== Memory access at offset 168 is inside this variable\r\n    [224, 225) 'ref.tmp14' (line 377)\r\n    [240, 288) 'LEMObjectsCurrentStates' (line 378)\r\n    [320, 368) '__begin1' (line 379)\r\n    [400, 448) '__end1' (line 379)\r\n    [480, 488) '__begin1106' (line 393)\r\n    [512, 520) '__end1110' (line 393)\r\n    [544, 560) 'ref.tmp136' (line 395)\r\n    [576, 760) 'ref.tmp165' (line 399)\r\nHINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork\r\n      (longjmp and C++ exceptions *are* supported)\r\nSUMMARY: AddressSanitizer: stack-use-after-scope /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8/bits/basic_string.h:922:16 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const\r\nShadow bytes around the buggy address:\r\n  0x10007d58d340: f8 f8 f8 f2 f2 f2 f2 f2 f8 f8 f8 f8 f8 f8 f8 f8\r\n  0x10007d58d350: f8 f8 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00\r\n  0x10007d58d360: 00 00 00 f2 f2 f2 f2 f2 f8 f8 f8 f2 f2 f2 f2 f2\r\n  0x10007d58d370: f8 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x10007d58d380: f1 f1 f1 f1 00 00 00 00 00 00 00 00 00 00 00 00\r\n=>0x10007d58d390: f2 f2 f2 f2 f8[f8]f8 f8 f2 f2 f2 f2 f8 f2 00 00\r\n  0x10007d58d3a0: 00 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00 f2 f2\r\n  0x10007d58d3b0: f2 f2 00 00 00 00 00 00 f2 f2 f2 f2 f8 f2 f2 f2\r\n  0x10007d58d3c0: f8 f2 f2 f2 f8 f8 f2 f2 f8 f8 f8 f8 f8 f8 f8 f8\r\n  0x10007d58d3d0: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f3\r\n  0x10007d58d3e0: f3 f3 f3 f3 f3 f3 f3 f3 00 00 00 00 00 00 00 00\r\nShadow byte legend (one shadow byte represents 8 application bytes):\r\n  Addressable:           00\r\n  Partially addressable: 01 02 03 04 05 06 07 \r\n  Heap left redzone:       fa\r\n  Freed heap region:       fd\r\n  Stack left redzone:      f1\r\n  Stack mid redzone:       f2\r\n  Stack right redzone:     f3\r\n  Stack after return:      f5\r\n  Stack use after scope:   f8\r\n  Global redzone:          f9\r\n  Global init order:       f6\r\n  Poisoned by user:        f7\r\n  Container overflow:      fc\r\n  Array cookie:            ac\r\n  Intra object redzone:    bb\r\n  ASan internal:           fe\r\n  Left alloca redzone:     ca\r\n  Right alloca redzone:    cb\r\n  Shadow gap:              cc\r\n```\r\n\r\nWhat I think is happening:\r\n- the string literal \"Radar\" is used to create a temporary `std::string`\r\n- that temporary is then bound to `const& std::string category` and its lifetime extended to the end of `filterBySensorCategory` scope\r\n- since the lambda expression is evaluated only after `filterBySensorCategory`'s scope, after `category`'s lifetime has ended => stack-use-after-scope\r\n\r\nCapturing the `category` parameter of `filterBySensorCategory` by value instead of reference solves this.\r\nThe inner lambda then captures this copy by reference.\r\n\r\nApparently, in C++14 we could make `category` an rvalue-reference and move from it with `by-reference capture with an initializer` to eliminate the need for a copy for most cases (calls to `filterBySensorCategory` with a string literal creating a temporary `std::string`).\r\n\r\nIn any case, copying a `std::string` of a short length (sensor category names will probably not surpass 16 characters) will be really fast (especially since short strings are stored directly in the object, no extra pointer derefence necessary, and will most likely happen on the stack).","created_at":"2018-11-30T13:35:06Z","updated_at":"2018-11-30T13:35:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/riebl/artery/pulls/56/commits","review_comments_url":"https://api.github.com/repos/riebl/artery/pulls/56/comments","review_comment_url":"https://api.github.com/repos/riebl/artery/pulls/comments{/number}","comments_url":"https://api.github.com/repos/riebl/artery/issues/56/comments","statuses_url":"https://api.github.com/repos/riebl/artery/statuses/88e4025bebbe89bea8ea9669b6e8bea354734a61","head":{"label":"hagau:lem_stack-use-after-scope","ref":"lem_stack-use-after-scope","sha":"88e4025bebbe89bea8ea9669b6e8bea354734a61","user":{"login":"hagau","id":28601035,"node_id":"MDQ6VXNlcjI4NjAxMDM1","avatar_url":"https://avatars1.githubusercontent.com/u/28601035?v=4","gravatar_id":"","url":"https://api.github.com/users/hagau","html_url":"https://github.com/hagau","followers_url":"https://api.github.com/users/hagau/followers","following_url":"https://api.github.com/users/hagau/following{/other_user}","gists_url":"https://api.github.com/users/hagau/gists{/gist_id}","starred_url":"https://api.github.com/users/hagau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hagau/subscriptions","organizations_url":"https://api.github.com/users/hagau/orgs","repos_url":"https://api.github.com/users/hagau/repos","events_url":"https://api.github.com/users/hagau/events{/privacy}","received_events_url":"https://api.github.com/users/hagau/received_events","type":"User","site_admin":false},"repo":{"id":132477274,"node_id":"MDEwOlJlcG9zaXRvcnkxMzI0NzcyNzQ=","name":"artery","full_name":"hagau/artery","private":false,"owner":{"login":"hagau","id":28601035,"node_id":"MDQ6VXNlcjI4NjAxMDM1","avatar_url":"https://avatars1.githubusercontent.com/u/28601035?v=4","gravatar_id":"","url":"https://api.github.com/users/hagau","html_url":"https://github.com/hagau","followers_url":"https://api.github.com/users/hagau/followers","following_url":"https://api.github.com/users/hagau/following{/other_user}","gists_url":"https://api.github.com/users/hagau/gists{/gist_id}","starred_url":"https://api.github.com/users/hagau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hagau/subscriptions","organizations_url":"https://api.github.com/users/hagau/orgs","repos_url":"https://api.github.com/users/hagau/repos","events_url":"https://api.github.com/users/hagau/events{/privacy}","received_events_url":"https://api.github.com/users/hagau/received_events","type":"User","site_admin":false},"html_url":"https://github.com/hagau/artery","description":"ETSI ITS-G5 application layer for Veins","fork":true,"url":"https://api.github.com/repos/hagau/artery","forks_url":"https://api.github.com/repos/hagau/artery/forks","keys_url":"https://api.github.com/repos/hagau/artery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hagau/artery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hagau/artery/teams","hooks_url":"https://api.github.com/repos/hagau/artery/hooks","issue_events_url":"https://api.github.com/repos/hagau/artery/issues/events{/number}","events_url":"https://api.github.com/repos/hagau/artery/events","assignees_url":"https://api.github.com/repos/hagau/artery/assignees{/user}","branches_url":"https://api.github.com/repos/hagau/artery/branches{/branch}","tags_url":"https://api.github.com/repos/hagau/artery/tags","blobs_url":"https://api.github.com/repos/hagau/artery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hagau/artery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hagau/artery/git/refs{/sha}","trees_url":"https://api.github.com/repos/hagau/artery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hagau/artery/statuses/{sha}","languages_url":"https://api.github.com/repos/hagau/artery/languages","stargazers_url":"https://api.github.com/repos/hagau/artery/stargazers","contributors_url":"https://api.github.com/repos/hagau/artery/contributors","subscribers_url":"https://api.github.com/repos/hagau/artery/subscribers","subscription_url":"https://api.github.com/repos/hagau/artery/subscription","commits_url":"https://api.github.com/repos/hagau/artery/commits{/sha}","git_commits_url":"https://api.github.com/repos/hagau/artery/git/commits{/sha}","comments_url":"https://api.github.com/repos/hagau/artery/comments{/number}","issue_comment_url":"https://api.github.com/repos/hagau/artery/issues/comments{/number}","contents_url":"https://api.github.com/repos/hagau/artery/contents/{+path}","compare_url":"https://api.github.com/repos/hagau/artery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hagau/artery/merges","archive_url":"https://api.github.com/repos/hagau/artery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hagau/artery/downloads","issues_url":"https://api.github.com/repos/hagau/artery/issues{/number}","pulls_url":"https://api.github.com/repos/hagau/artery/pulls{/number}","milestones_url":"https://api.github.com/repos/hagau/artery/milestones{/number}","notifications_url":"https://api.github.com/repos/hagau/artery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hagau/artery/labels{/name}","releases_url":"https://api.github.com/repos/hagau/artery/releases{/id}","deployments_url":"https://api.github.com/repos/hagau/artery/deployments","created_at":"2018-05-07T15:03:00Z","updated_at":"2018-11-14T11:46:29Z","pushed_at":"2018-11-30T12:01:06Z","git_url":"git://github.com/hagau/artery.git","ssh_url":"git@github.com:hagau/artery.git","clone_url":"https://github.com/hagau/artery.git","svn_url":"https://github.com/hagau/artery","homepage":null,"size":39712,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"riebl:master","ref":"master","sha":"770a18d3429bad9984bb8e17b022ace3c7ba68e6","user":{"login":"riebl","id":6770449,"node_id":"MDQ6VXNlcjY3NzA0NDk=","avatar_url":"https://avatars0.githubusercontent.com/u/6770449?v=4","gravatar_id":"","url":"https://api.github.com/users/riebl","html_url":"https://github.com/riebl","followers_url":"https://api.github.com/users/riebl/followers","following_url":"https://api.github.com/users/riebl/following{/other_user}","gists_url":"https://api.github.com/users/riebl/gists{/gist_id}","starred_url":"https://api.github.com/users/riebl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riebl/subscriptions","organizations_url":"https://api.github.com/users/riebl/orgs","repos_url":"https://api.github.com/users/riebl/repos","events_url":"https://api.github.com/users/riebl/events{/privacy}","received_events_url":"https://api.github.com/users/riebl/received_events","type":"User","site_admin":false},"repo":{"id":36668566,"node_id":"MDEwOlJlcG9zaXRvcnkzNjY2ODU2Ng==","name":"artery","full_name":"riebl/artery","private":false,"owner":{"login":"riebl","id":6770449,"node_id":"MDQ6VXNlcjY3NzA0NDk=","avatar_url":"https://avatars0.githubusercontent.com/u/6770449?v=4","gravatar_id":"","url":"https://api.github.com/users/riebl","html_url":"https://github.com/riebl","followers_url":"https://api.github.com/users/riebl/followers","following_url":"https://api.github.com/users/riebl/following{/other_user}","gists_url":"https://api.github.com/users/riebl/gists{/gist_id}","starred_url":"https://api.github.com/users/riebl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riebl/subscriptions","organizations_url":"https://api.github.com/users/riebl/orgs","repos_url":"https://api.github.com/users/riebl/repos","events_url":"https://api.github.com/users/riebl/events{/privacy}","received_events_url":"https://api.github.com/users/riebl/received_events","type":"User","site_admin":false},"html_url":"https://github.com/riebl/artery","description":"OMNeT++ V2X simulation framework for ETSI ITS-G5","fork":false,"url":"https://api.github.com/repos/riebl/artery","forks_url":"https://api.github.com/repos/riebl/artery/forks","keys_url":"https://api.github.com/repos/riebl/artery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/riebl/artery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/riebl/artery/teams","hooks_url":"https://api.github.com/repos/riebl/artery/hooks","issue_events_url":"https://api.github.com/repos/riebl/artery/issues/events{/number}","events_url":"https://api.github.com/repos/riebl/artery/events","assignees_url":"https://api.github.com/repos/riebl/artery/assignees{/user}","branches_url":"https://api.github.com/repos/riebl/artery/branches{/branch}","tags_url":"https://api.github.com/repos/riebl/artery/tags","blobs_url":"https://api.github.com/repos/riebl/artery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/riebl/artery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/riebl/artery/git/refs{/sha}","trees_url":"https://api.github.com/repos/riebl/artery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/riebl/artery/statuses/{sha}","languages_url":"https://api.github.com/repos/riebl/artery/languages","stargazers_url":"https://api.github.com/repos/riebl/artery/stargazers","contributors_url":"https://api.github.com/repos/riebl/artery/contributors","subscribers_url":"https://api.github.com/repos/riebl/artery/subscribers","subscription_url":"https://api.github.com/repos/riebl/artery/subscription","commits_url":"https://api.github.com/repos/riebl/artery/commits{/sha}","git_commits_url":"https://api.github.com/repos/riebl/artery/git/commits{/sha}","comments_url":"https://api.github.com/repos/riebl/artery/comments{/number}","issue_comment_url":"https://api.github.com/repos/riebl/artery/issues/comments{/number}","contents_url":"https://api.github.com/repos/riebl/artery/contents/{+path}","compare_url":"https://api.github.com/repos/riebl/artery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/riebl/artery/merges","archive_url":"https://api.github.com/repos/riebl/artery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/riebl/artery/downloads","issues_url":"https://api.github.com/repos/riebl/artery/issues{/number}","pulls_url":"https://api.github.com/repos/riebl/artery/pulls{/number}","milestones_url":"https://api.github.com/repos/riebl/artery/milestones{/number}","notifications_url":"https://api.github.com/repos/riebl/artery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/riebl/artery/labels{/name}","releases_url":"https://api.github.com/repos/riebl/artery/releases{/id}","deployments_url":"https://api.github.com/repos/riebl/artery/deployments","created_at":"2015-06-01T15:07:04Z","updated_at":"2018-11-30T03:04:06Z","pushed_at":"2018-11-26T10:21:21Z","git_url":"git://github.com/riebl/artery.git","ssh_url":"git@github.com:riebl/artery.git","clone_url":"https://github.com/riebl/artery.git","svn_url":"https://github.com/riebl/artery","homepage":"","size":39689,"stargazers_count":29,"watchers_count":29,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":17,"open_issues":11,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/riebl/artery/pulls/56"},"html":{"href":"https://github.com/riebl/artery/pull/56"},"issue":{"href":"https://api.github.com/repos/riebl/artery/issues/56"},"comments":{"href":"https://api.github.com/repos/riebl/artery/issues/56/comments"},"review_comments":{"href":"https://api.github.com/repos/riebl/artery/pulls/56/comments"},"review_comment":{"href":"https://api.github.com/repos/riebl/artery/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/riebl/artery/pulls/56/commits"},"statuses":{"href":"https://api.github.com/repos/riebl/artery/statuses/88e4025bebbe89bea8ea9669b6e8bea354734a61"}},"author_association":"CONTRIBUTOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":5,"deletions":2,"changed_files":1}}
{"actor":{"display_login":"hagau"}}