[Bro-Dev] #366: Crash with optional table and record ctors

Bro Tracker bro at tracker.icir.org
Fri Jan 28 10:09:52 PST 2011


#366: Crash with optional table and record ctors
----------------------+------------------------
  Reporter:  robin    |      Owner:
      Type:  Problem  |     Status:  new
  Priority:  Normal   |  Milestone:
 Component:  Bro      |    Version:  git/master
Resolution:           |   Keywords:
----------------------+------------------------

Old description:

> This crashes:
>
>     type request: record {
>         ...
>         t: time;
>         x: table[string] of string &optional &default="-";
>         ...
>         }
>
>     local req: request = [$t=network_time()];  # <-- here
>

> (gdb) print this
> Cannot access memory at address 0x0
> #0  RecordVal::Assign (this=0x10125dcd0, field=6, new_val=0x0,
> op=OP_ASSIGN) at /Users/robin/bro/master/src/Val.cc:2850
> #1  0x00000001000c6d5f in RecordCoerceExpr::Fold (this=0x10123e960,
> v=0x10125eab0) at /Users/robin/bro/master/src/Expr.cc:4052
> #2  0x00000001000c9485 in UnaryExpr::Eval (this=0x10123e960, f=<value
> temporarily unavailable, due to optimizations>) at
> /Users/robin/bro/master/src/Expr.cc:509
> #3  0x00000001000c3eea in AssignExpr::Eval (this=0x10123e830,
> f=0x101254110) at /Users/robin/bro/master/src/Expr.cc:2609
> warning: .o file
> "/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/Stmt.cc.o"
> more recent than executable timestamp in "/Users/robin/bin/bro"
> warning: Couldn't open object file
> '/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/Stmt.cc.o'
> #4  0x00000001001766a6 in ExprStmt::Exec ()
> #5  0x0000000100172640 in StmtList::Exec ()
> #6  0x0000000100172640 in StmtList::Exec ()
> warning: .o file
> "/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/Func.cc.o"
> more recent than executable timestamp in "/Users/robin/bin/bro"
> warning: Couldn't open object file
> '/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/Func.cc.o'
> #7  0x00000001000e037d in BroFunc::Call ()
> warning: .o file
> "/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/EventHandler.cc.o"
> more recent than executable timestamp in "/Users/robin/bin/bro"
> warning: Couldn't open object file
> '/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/EventHandler.cc.o'
> #8  0x000000010009f154 in EventHandler::Call ()
> warning: .o file
> "/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/Event.cc.o"
> more recent than executable timestamp in "/Users/robin/bin/bro"
> warning: Couldn't open object file
> '/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/Event.cc.o'
> #9  0x000000010009eb1d in EventMgr::Dispatch ()
> #10 0x000000010009ec48 in EventMgr::Drain ()
> warning: .o file
> "/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/Net.cc.o"
> more recent than executable timestamp in "/Users/robin/bin/bro"
> warning: Couldn't open object file
> '/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/Net.cc.o'
> #11 0x00000001001297b5 in net_packet_dispatch ()
> warning: .o file
> "/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/PktSrc.cc.o"
> more recent than executable timestamp in "/Users/robin/bin/bro"
> warning: Couldn't open object file
> '/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/PktSrc.cc.o'
> #12 0x0000000100136cf7 in PktSrc::Process ()
> #13 0x0000000100129a50 in net_run ()
> warning: .o file
> "/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/main.cc.o"
> more recent than executable timestamp in "/Users/robin/bin/bro"
> warning: Couldn't open object file
> '/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/main.cc.o'
> #14 0x00000001000600b3 in main ()

New description:

 This crashes:

 {{{
     type request: record {
         ...
         t: time;
         x: table[string] of string &optional &default="-";
         ...
         }

     local req: request = [$t=network_time()];  # <-- here


 (gdb) print this
 Cannot access memory at address 0x0
 #0  RecordVal::Assign (this=0x10125dcd0, field=6, new_val=0x0,
 op=OP_ASSIGN) at /Users/robin/bro/master/src/Val.cc:2850
 #1  0x00000001000c6d5f in RecordCoerceExpr::Fold (this=0x10123e960,
 v=0x10125eab0) at /Users/robin/bro/master/src/Expr.cc:4052
 #2  0x00000001000c9485 in UnaryExpr::Eval (this=0x10123e960, f=<value
 temporarily unavailable, due to optimizations>) at
 /Users/robin/bro/master/src/Expr.cc:509
 #3  0x00000001000c3eea in AssignExpr::Eval (this=0x10123e830,
 f=0x101254110) at /Users/robin/bro/master/src/Expr.cc:2609
 warning: .o file
 "/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/Stmt.cc.o"
 more recent than executable timestamp in "/Users/robin/bin/bro"
 warning: Couldn't open object file
 '/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/Stmt.cc.o'
 #4  0x00000001001766a6 in ExprStmt::Exec ()
 #5  0x0000000100172640 in StmtList::Exec ()
 #6  0x0000000100172640 in StmtList::Exec ()
 warning: .o file
 "/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/Func.cc.o"
 more recent than executable timestamp in "/Users/robin/bin/bro"
 warning: Couldn't open object file
 '/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/Func.cc.o'
 #7  0x00000001000e037d in BroFunc::Call ()
 warning: .o file
 "/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/EventHandler.cc.o"
 more recent than executable timestamp in "/Users/robin/bin/bro"
 warning: Couldn't open object file
 '/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/EventHandler.cc.o'
 #8  0x000000010009f154 in EventHandler::Call ()
 warning: .o file
 "/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/Event.cc.o"
 more recent than executable timestamp in "/Users/robin/bin/bro"
 warning: Couldn't open object file
 '/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/Event.cc.o'
 #9  0x000000010009eb1d in EventMgr::Dispatch ()
 #10 0x000000010009ec48 in EventMgr::Drain ()
 warning: .o file
 "/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/Net.cc.o"
 more recent than executable timestamp in "/Users/robin/bin/bro"
 warning: Couldn't open object file
 '/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/Net.cc.o'
 #11 0x00000001001297b5 in net_packet_dispatch ()
 warning: .o file
 "/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/PktSrc.cc.o"
 more recent than executable timestamp in "/Users/robin/bin/bro"
 warning: Couldn't open object file
 '/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/PktSrc.cc.o'
 #12 0x0000000100136cf7 in PktSrc::Process ()
 #13 0x0000000100129a50 in net_run ()
 warning: .o file
 "/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/main.cc.o"
 more recent than executable timestamp in "/Users/robin/bin/bro"
 warning: Couldn't open object file
 '/Users/robin/Dropbox/Home/bro/master/build/src/CMakeFiles/bro.dir/main.cc.o'
 #14 0x00000001000600b3 in main ()
 }}}

--

Comment (by robin):

 Vern, yes that was the intent. However, I'm not sure it actually works
 here as I intended: as the value is optional, the table instance is
 created later, and I'm guessing not transfering the &default over.

 Seth, so this is not exactly the same problem you were running into for
 the logging framework, is it?

-- 
Ticket URL: <http://tracker.icir.org/bro/ticket/366#comment:2>
Bro Tracker <http://tracker.icir.org/bro>
Bro Issue Tracker



More information about the bro-dev mailing list