You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like there's validation missing rejecting the inner field: it should use the same logic that we use for bytes fields outside of vectors to enforce that there's some termination condition (e.g, &eod, &size, etc.).
elseif ( constauto& x = pt->type()->tryAs<hilti::type::Vector>() ) {
if ( auto rc = isParseableType(x->elementType(), f); ! rc )
return rc;
returnhilti::Nothing();
}
If you surround bytes in parentheses, this actually gets you the error properly:
module test;
public type X = unit {
a: (bytes)[10] &size=5;
};
The only change is parentheses around bytes. That gets me:
[error] test.spicy:4:9-4:13: bytes field requires one of &eod, &parse_at, &parse_from, &size, &until, &until-including
[error] spicyc: aborting after errors
I'm not quite sure how to get the attributes down to the inner bytes type since the attributes seem applied to fields not types, but I'll look into that :)
This toy parser is applying size to the total size of the vector but the bytes in the vector actually have no termination condition.
The text was updated successfully, but these errors were encountered: