# Segmentation fault, Bro and a Debian

**URL:** <https://community.zeek.org/t/segmentation-fault-bro-and-a-debian/365>\
**Category:** Zeek\
**Created:** [April 29, 2003, 3:48pm UTC](https://community.zeek.org/t/segmentation-fault-bro-and-a-debian/365 "2003-04-29T15:48:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sylvain\_de\_Tilly1](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@Sylvain\_de\_Tilly1](https://community.zeek.org/u/Sylvain_de_Tilly1)\
**Post date:** [April 29, 2003, 3:48pm UTC](https://community.zeek.org/t/segmentation-fault-bro-and-a-debian/365/1 "2003-04-29T15:48:43Z")

</div>

Hi,

I try to use bro under Debian un-stable (today upgrade) and after some  
light modification, I was able to compile bro. But after that, I 've a  
segmentation fault...

First, modifications :

1- I've some gcc 3.2.3 problem which looks like :

> g++ -o bif\_parse.o -c bif\_parse.cc  
> builtin-func.y:63: 'vector' is used as a type, but is not defined as a type.  
> builtin-func.y: In function `int yyparse()':  
> builtin-func.y:151: `args' undeclared (first use this function)  
> builtin-func.y:151: (Each undeclared identifier is reported only once for each  
> &nbsp;&nbsp;&nbsp;function it appears in.)  
> make: \*\*\* [bif\_parse.o] Error 1

I solve them by added "using namespace std;" just after the include headers.

Same things with Type.h and Anon.h

2- The "yy\_current\_buffer" (line 474) not declare... I change "if (  
&nbsp;&nbsp;&nbsp;yy\_current\_buffer )" it by "if ( YY\_CURRENT\_BUFFER )" and the  
&nbsp;&nbsp;&nbsp;compilation continue.

3- I replace '#include \<hash\_map\>' by '#include \<hash\_map.h\>' because,  
&nbsp;&nbsp;&nbsp;hash\_map wasn't founded. This work fine but added a warning like that:

> /usr/include/c++/3.2/backward/backward\_warning.h:32:2: warning:  
> #warning This file includes at least one deprecated or antiquated  
> header. Please consider using one of the 32 headers found in section  
> 17.4.1.2 of the C++ standard. Examples include substituting the \<X\>  
> header for the \<X.h\> header for C++ includes, or \<sstream\> instead of  
> the deprecated header \<strstream.h\>. To disable this warning use  
> -Wno-deprecated.

4- The function isspace wasn't founded too in Debug.cc, so I added  
&nbsp;&nbsp;&nbsp;"#include \<ctype.h\>"

5- The DebugCmds.cc file generate a problem too :

> g++ -I. -Ilibedit -O -Ilinux-include -c DebugCmds.cc  
> DebugCmds.cc: In function `int find\_all\_matching\_cmds(const std::string&, const  
> &nbsp;&nbsp;&nbsp;char\*\*)':  
> DebugCmds.cc:164: invalid conversion from `const char*' to `unsigned int'  
> DebugCmds.cc:164: initializing argument 1 of `int std::basic\_string\<\_CharT,  
> &nbsp;&nbsp;&nbsp;\_Traits, \_Alloc\>::compare(\_Alloc::size\_type, \_Alloc::size\_type, const  
> &nbsp;&nbsp;&nbsp;\_CharT\*) const [with \_CharT = char, \_Traits = std::char\_traits\<char\>, \_Alloc  
> &nbsp;&nbsp;&nbsp;= std::allocator\<char\>]'  
> DebugCmds.cc:164: invalid conversion from `unsigned int' to `const char\*'  
> DebugCmds.cc:164: initializing argument 3 of `int std::basic\_string\<\_CharT,  
> &nbsp;&nbsp;&nbsp;\_Traits, \_Alloc\>::compare(\_Alloc::size\_type, \_Alloc::size\_type, const  
> &nbsp;&nbsp;&nbsp;\_CharT\*) const [with \_CharT = char, \_Traits = std::char\_traits\<char\>, \_Alloc  
> &nbsp;&nbsp;&nbsp;= std::allocator\<char\>]'  
> make: \*\*\* [DebugCmds.o] Error 1

I just change "if ( prefix.compare(curr\_name, 0, arglen ) )" by "if (  
prefix.compare(arglen, 0, curr\_name ) )"

6- A classical link problem with bro compilation under Linux, solve by  
&nbsp;&nbsp;&nbsp;replacing: "-lresolv" by "/usr/lib/resolv.a" in the Makefile.

After that, the compilation go to the end but, when I compile bro with  
the -g flag and run gdb, I could see that:

> (gdb) r -i eth0  
> Starting program: /usr/local/src/bro-pub-0.8a20/bro -i eth0
> 
> Program received signal SIGSEGV, Segmentation fault.  
> 0x401b3364 in strcmp () from /lib/libc.so.6  
> (gdb) bt  
> #0 0x401b3364 in strcmp () from /lib/libc.so.6  
> #1 0x0804db83 in streq(char const\*, char const\*) (s1=0x0, s2=0x0)  
> &nbsp;&nbsp;&nbsp;&nbsp;at util.cc:54  
> #2 0x0809e5c9 in BroObj::SetLocationInfo(Location const\*, Location const\*) (  
> &nbsp;&nbsp;&nbsp;&nbsp;this=0x812ffb8, start=0xbfffe24c, end=0xbfffe24c) at Obj.cc:99  
> #3 0x0805c6ff in Attr (this=0x812ffb8, t=ATTR\_OPTIONAL, e=0x0) at Attr.cc:42  
> #4 0x0805070e in yyparse() () at parse.y:868  
> #5 0x0804cb93 in main (argc=135439840, argv=0xbffffdd4) at main.cc:328

> (gdb) p start\_location -\> first\_line  
> $1 = 137  
> (gdb) p start\_location -\> last\_line  
> $2 = 137

I know that I've done too much modification from original  
sources... But via some fprintf, I discover that, in the previous call  
to this function, the Locations was in the bro.init file.

Does anybody have an idea ?

Thanks for all. Regards,

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/zeek/original/1X/f09d732bc2cc7c7cc7e35db67cf4e1d5233ce7a7.png) [@system](https://community.zeek.org/u/system)\
**Post date:** [May 6, 2022, 3:36pm UTC](https://community.zeek.org/t/segmentation-fault-bro-and-a-debian/365/2 "2022-05-06T15:36:44Z")

</div>


