Assertion 'field' failed.

Hi,

i’m writing an analyzer for a protocol, i wrote all files needed and when 'make’ing bro i get an error of:
binpac: …/bro-2.4-beta/aux/binpac/src/pac_expr.cc:225: RecordField* {anonymous}::GetRecordField(const ID*, Env*): Assertion ‘field’ failed.
i assume the error comes from .pac files so what could possibly generate this kind of error?

regards,

Hi,

That's a rather vague error, unfortunately. You can try using gdb to
debug and pinpoint which record and field this is referring to. Do you
have the code available for review somewhere, or could you share the
snippet that you suspect is the issue?

  --Vlad

i think i found the responsible,

i have a record :

type myrec = record {

//some fields.
last_field: bytestring &restofdata;
} &length = sizeof(this);

with this length specification i get the RecordField* error and when trying &length=20+sizeof(last_field) i get “cannot determine initial buffer length for type myrec” and without &length it passes.
so far im not going to specify the &length value and let you know if something comes up.

thanks,

Yeah, that &length looks suspicious to me. &length=sizeof(this) is
essentially saying "set the length of the record to the size of the
record."

I'd try it without the length specified at all, like you said.

You might want to review this section of the documentation:
https://www.bro.org/sphinx/components/binpac/README.html#buffering

  --Vlad