zeek / spicy

C++ parser generator for dissecting protocols & files.
https://docs.zeek.org/projects/spicy
Other
243 stars 37 forks source link

`spicyc` stack overflow for cyclic import #1784

Closed bbannier closed 1 month ago

bbannier commented 1 month ago
module f1;
import f2;
module f2;
import f1;
$ spicyc -dj f1.spicy f2.spicy
AddressSanitizer:DEADLYSIGNAL
=================================================================
==76099==ERROR: AddressSanitizer: stack-overflow on address 0x00016ab2bff8 (pc 0x000105e813b4 bp 0x00016ab2c010 sp 0x00016ab2bff0 T0)
    #0 0x105e813b4 in std::__1::__wrap_iter<char const*>::__wrap_iter[abi:v160006](void const*, char const*) wrap_iter.h:141
    #1 0x105e812c4 in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::__make_const_iterator[abi:v160006](char const*) const string:821
    #2 0x105e80950 in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::begin[abi:v160006]() const string:1043
    #3 0x105e7fc10 in ghc::filesystem::path::compare(ghc::filesystem::path const&) const filesystem.hpp:3005
    #4 0x10604a12c in ghc::filesystem::operator<(ghc::filesystem::path const&, ghc::filesystem::path const&) filesystem.hpp:3519
    #5 0x10604a2b4 in bool std::__1::__tuple_less<2ul>::operator()[abi:v160006]<std::__1::tuple<hilti::ID, ghc::filesystem::path, ghc::filesystem::path, ghc::filesystem::path>, std::__1::tuple<hilti::ID, ghc::filesystem::path, ghc::filesystem::path, ghc::filesystem::path>>(std::__1::tuple<hilti::ID, ghc::filesystem::path, ghc::filesystem::path, ghc::filesystem::path> const&, std::__1::tuple<hilti::ID, ghc::filesystem::path, ghc::filesystem::path, ghc::filesystem::path> const&) tuple:1595
    #6 0x10604a028 in bool std::__1::__tuple_less<3ul>::operator()[abi:v160006]<std::__1::tuple<hilti::ID, ghc::filesystem::path, ghc::filesystem::path, ghc::filesystem::path>, std::__1::tuple<hilti::ID, ghc::filesystem::path, ghc::filesystem::path, ghc::filesystem::path>>(std::__1::tuple<hilti::ID, ghc::filesystem::path, ghc::filesystem::path, ghc::filesystem::path> const&, std::__1::tuple<hilti::ID, ghc::filesystem::path, ghc::filesystem::path, ghc::filesystem::path> const&) tuple:1599
    #7 0x106049d64 in bool std::__1::__tuple_less<4ul>::operator()[abi:v160006]<std::__1::tuple<hilti::ID, ghc::filesystem::path, ghc::filesystem::path, ghc::filesystem::path>, std::__1::tuple<hilti::ID, ghc::filesystem::path, ghc::filesystem::path, ghc::filesystem::path>>(std::__1::tuple<hilti::ID, ghc::filesystem::path, ghc::filesystem::path, ghc::filesystem::path> const&, std::__1::tuple<hilti::ID, ghc::filesystem::path, ghc::filesystem::path, ghc::filesystem::path> const&) tuple:1599
    #8 0x106049a68 in bool std::__1::operator<[abi:v160006]<hilti::ID, ghc::filesystem::path, ghc::filesystem::path, ghc::filesystem::path, hilti::ID, ghc::filesystem::path, ghc::filesystem::path, ghc::filesystem::path>(std::__1::tuple<hilti::ID, ghc::filesystem::path, ghc::filesystem::path, ghc::filesystem::path> const&, std::__1::tuple<hilti::ID, ghc::filesystem::path, ghc::filesystem::path, ghc::filesystem::path> const&) tuple:1620
    #9 0x1060496fc in hilti::declaration::module::UID::operator<(hilti::declaration::module::UID const&) const module-uid.h:91
    #10 0x109da7aa4 in std::__1::less<hilti::declaration::module::UID>::operator()[abi:v160006](hilti::declaration::module::UID const&, hilti::declaration::module::UID const&) const operations.h:384
    #11 0x109daa714 in std::__1::__tree_node_base<void*>*& std::__1::__tree<hilti::declaration::module::UID, std::__1::less<hilti::declaration::module::UID>, std::__1::allocator<hilti::declaration::module::UID>>::__find_equal<hilti::declaration::module::UID>(std::__1::__tree_end_node<std::__1::__tree_node_base<void*>*>*&, hilti::declaration::module::UID const&) __tree:1987
    #12 0x109daa31c in std::__1::pair<std::__1::__tree_iterator<hilti::declaration::module::UID, std::__1::__tree_node<hilti::declaration::module::UID, void*>*, long>, bool> std::__1::__tree<hilti::declaration::module::UID, std::__1::less<hilti::declaration::module::UID>, std::__1::allocator<hilti::declaration::module::UID>>::__emplace_unique_key_args<hilti::declaration::module::UID, hilti::declaration::module::UID const&>(hilti::declaration::module::UID const&, hilti::declaration::module::UID const&) __tree:2103
    #13 0x109daa040 in std::__1::__tree<hilti::declaration::module::UID, std::__1::less<hilti::declaration::module::UID>, std::__1::allocator<hilti::declaration::module::UID>>::__insert_unique[abi:v160006](hilti::declaration::module::UID const&)__tree:1268
    #14 0x109da76a4 in std::__1::set<hilti::declaration::module::UID, std::__1::less<hilti::declaration::module::UID>, std::__1::allocator<hilti::declaration::module::UID>>::insert[abi:v160006](hilti::declaration::module::UID const&) set:732
    #15 0x109d2fc88 in _recursiveDependencies(hilti::ASTContext const*, hilti::declaration::Module*, std::__1::set<hilti::declaration::module::UID, std::__1::less<hilti::declaration::module::UID>, std::__1::allocator<hilti::declaration::module::UID>>*) ast-context.cc:771
    #16 0x109d2fd30 in _recursiveDependencies(hilti::ASTContext const*, hilti::declaration::Module*, std::__1::set<hilti::declaration::module::UID, std::__1::less<hilti::declaration::module::UID>, std::__1::allocator<hilti::declaration::module::UID>>*) ast-context.cc:774
    #17 0x109d2fd30 in _recursiveDependencies(hilti::ASTContext const*, hilti::declaration::Module*, std::__1::set<hilti::declaration::module::UID, std::__1::less<hilti::declaration::module::UID>, std::__1::allocator<hilti::declaration::module::UID>>*) ast-context.cc:774
    (repeats)