zserio icon indicating copy to clipboard operation
zserio copied to clipboard

Offset expressions should be disabled

Open mikir opened this issue 8 months ago • 0 comments

Consider the following schema:

struct Schema
{
    uint32 myOffsetArray[];
    uint8 someValue;
myOffsetArray[@index % someValue]:
    string stringArray[];
};

Such schema is not possible to validate during the zserio compilation. It can be valid in some cases. In all cases, it smells because the offsets in myOffsetArray can be easily overwrite.

Because we can not think of any meaningful use case that would require this, we suggest to completely disable offset expressions except of the simple [@index].

For more info, please have a look to the issue #640.

mikir avatar Jun 21 '24 10:06 mikir