I have some variable length data that needs to be skipped, similar to the following example:
module Test;
type Ctx = tuple<is_large_pad: bool>;
public type Testing = unit {
%context = Ctx;
padding: skip Pad(self.context());
data: bytes &eod;
on %init { self.context().is_large_pad = True; }
on %done { print self; }
};
type Pad = unit(c: Ctx&) {
: skip uint8;
: skip uint8[3] if ( c.is_large_pad );
};
But this doesn't work
printf '\01\02\03\04Foo' | spicy-driver test.spicy
[error] terminating with uncaught exception of type hilti::rt::NullReference: attempt to access null reference (test.spicy:17:5-17:42)
When I removed the skip keyword from padding, everything worked fine
I have some variable length data that needs to be skipped, similar to the following example:
But this doesn't work
When I removed the
skip
keyword frompadding
, everything worked fine