zeek
zeek copied to clipboard
Fix a crash in Zeekygen when asking it to produce docs for Zeek-internal identifiers
This is a bit subtle but I hit it while tinkering with Zeekygen: create a Zeekygen config that asks for docs on all identifiers, then (the ordering is important) create a dummy results file and run it:
$ echo -e 'identifier\t*\ttest.rst' >zeekygen.cfg
$ touch test.zeek test.rst
$ zeek -b -X ./zeekygen.cfg ./test.zeek
Segmentation fault (core dumped)
Alternatively you can leave out the touch test.rst step and just run Zeek twice, and it won't segfault the first time, but the second time. That's because getting to the offending code requires a pre-existing docs output file that is newer than the config file.
The empty test.zeek just prevents Zeek from dropping into interactive mode.
Details:
#0 0x169becc in zeek::zeekygen::detail::Info::GetModificationTime() const /home/christian/devel/zeek/zeek/src/include/zeek/zeekygen/Info.h:28
#1 0x169becc in zeek::zeekygen::detail::IdentifierInfo::DoGetModificationTime() const /home/christian/devel/zeek/zeek/src/zeekygen/IdentifierInfo.cc:135
#2 0x16c32b8 in zeek::zeekygen::detail::Info::GetModificationTime() const /home/christian/devel/zeek/zeek/src/include/zeek/zeekygen/Info.h:28
#3 0x16c32b8 in bool zeek::zeekygen::detail::Manager::IsUpToDate<zeek::zeekygen::detail::IdentifierInfo>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<zeek::zeekygen::detail::IdentifierInfo*, std::allocator<zeek::zeekygen::detail::IdentifierInfo*> > const&) co
nst /home/christian/devel/zeek/zeek/src/include/zeek/zeekygen/Manager.h:264
#4 0x16a6756 in zeek::zeekygen::detail::IdentifierTarget::DoGenerate() const /home/christian/devel/zeek/zeek/src/zeekygen/Target.cc:570
#5 0x172319b in zeek::zeekygen::detail::Target::Generate() const /home/christian/devel/zeek/zeek/src/include/zeek/zeekygen/Target.h:76
#6 0x172319b in zeek::zeekygen::detail::Config::GenerateDocs() const /home/christian/devel/zeek/zeek/src/zeekygen/Configuration.cc:85
#7 0x16688e3 in zeek::zeekygen::detail::Manager::GenerateDocs() const /home/christian/devel/zeek/zeek/src/zeekygen/Manager.cc:119
#8 0x1e14893 in zeek::detail::setup(int, char**, zeek::Options*) /home/christian/devel/zeek/zeek/src/zeek-setup.cc:863
#9 0x7bee43 in main /home/christian/devel/zeek/zeek/src/main.cc:52
#10 0x7f68aaa46149 in __libc_start_call_main (/lib64/libc.so.6+0x28149) (BuildId: 0d710e9d9dc10c500b8119c85da75004183618e2)
#11 0x7f68aaa4620a in __libc_start_main_impl (/lib64/libc.so.6+0x2820a) (BuildId: 0d710e9d9dc10c500b8119c85da75004183618e2)
#12 0x7bec34 in _start (/home/christian/inst/opt/zeek/bin/zeek+0x7bec34) (BuildId: af61c2abddee672ece33c2243f0af99ec7a1cad9)