Ticket #464 (closed Merge Request: fixed)

Opened 12 months ago

Last modified 4 months ago

Bug with complex data structures

Reported by: seth Owned by: robin
Priority: High Milestone: Bro2.1
Component: Bro Version:
Keywords: Cc:

Description

This script:

type MetaData: record {
        a: count;
        tags: set[string];
};

global ip_data: table[addr] of set[MetaData] = table();

local m: MetaData = [$a=4, $tags=set("blah")];
if ( 1.2.3.4 !in ip_data )
        ip_data[1.2.3.4] = set(m);
else
        add ip_data[1.2.3.4][m];

Results in this error:

1306867820.149493 <no location> and ./test29.bro, line 10
   ([a=4, tags={blah}] and list of record { a:count; tags:set[string]; }): error, index type doesn't match table

Change History

comment:1 Changed 12 months ago by robin

I'm actually getting a different error: 1306972010.461281 internal error: bad index type in CompositeHash::CompositeHash

comment:2 Changed 12 months ago by robin

Turns out records that have more complex fields can't be used as indices for sets.

I think we could add that, but it would be a bit of work. How important is it? Can you use a table[addr] of vector, where the vector then stores the MetaData??

comment:2 Changed 12 months ago by seth

I think we could add that, but it would be a bit of work. How important is
it? Can you use a table[addr] of vector, where the vector then stores the
MetaData??

Ah, I see what you are saying. Yes, I should be able to do that.

comment:3 Changed 12 months ago by seth

I'm actually getting a different error: `1306972010.461281 internal error:
bad index type in CompositeHash::CompositeHash?`

Yeah, I started making some changes in CompHash?.cc and I forgot about it when I filed this ticket. The error you got is the one I meant to use for this ticket.

comment:4 Changed 11 months ago by seth

  • Milestone changed from Bro1.6 to Bro1.7

This needs fixed eventually, but it's not critical at the moment. Let's push it back to a later release.

comment:5 Changed 4 months ago by jsiwek

In [1e4c3d8ea293868d5c85e536201c327937c2d175/bro]:

Teach CompHash? to allow indexing by records with vector/table/set fields.

Addresses #464.

comment:6 Changed 4 months ago by jsiwek

  • Type changed from Problem to Merge Request

I believe the changes in topic/jsiwek/complex-record-indices fix this.

comment:7 Changed 4 months ago by robin

  • Owner set to robin
  • Status changed from new to closed
  • Resolution set to fixed

In [27ce62077f397dfe9deecc84a04345be122c5d75/bro]:

Merge remote-tracking branch 'origin/topic/jsiwek/complex-record-indices'

  • origin/topic/jsiwek/complex-record-indices: Teach CompHash? to allow indexing by records with vector/table/set fields.

Closes #464

Note: See TracTickets for help on using tickets.