[Bro-Dev] [JIRA] (BIT-1280) Checking index in vectors is broken

Robin Sommer (JIRA) jira at bro-tracker.atlassian.net
Fri Oct 31 16:28:07 PDT 2014


    [ https://bro-tracker.atlassian.net/browse/BIT-1280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18619#comment-18619 ] 

Robin Sommer commented on BIT-1280:
-----------------------------------

Merging.

Generally, I would actually prefer vector elements to be automatically initialized with null values corresponding to the vector's type; then the "in" would always return true. However, we don't have the concept of a type-specific null/default values.


> Checking index in vectors is broken
> -----------------------------------
>
>                 Key: BIT-1280
>                 URL: https://bro-tracker.atlassian.net/browse/BIT-1280
>             Project: Bro Issue Tracker
>          Issue Type: Problem
>          Components: Bro
>    Affects Versions: 2.4
>            Reporter: Seth Hall
>            Assignee: Robin Sommer
>             Fix For: 2.4
>
>
> If you try to check an index in a vector for existence, you get an error...
> {noformat}
> event bro_init()
> 	{
> 	local vec: vector of count = vector();
> 	if ( 2 in vec )
> 		print vec[2];
> 	print vec;
> 	}
> {noformat}
> Error:
> {quote}
> fatal error in bool: BroType::AsVectorType (bool/vector) (bool)
> {quote}



--
This message was sent by Atlassian JIRA
(v6.4-OD-07-004#64005)


More information about the bro-dev mailing list