Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java doesn't check compound parameters which are used deep in packed arrays #616

Closed
Mi-La opened this issue May 16, 2024 · 1 comment
Closed
Assignees
Labels
bug Something isn't working java Java language generator
Milestone

Comments

@Mi-La
Copy link
Contributor

Mi-La commented May 16, 2024

Zserio version and language
Zserio: 2.14.0
Language: Java

Describe the bug
Zserio serialization mechanism should always check the parameters with the restrictions given by schema. But in Java the checking code is missing, probably by accident.

How to reproduce
Steps to reproduce the behavior:

  • Schema (minimum working example):
struct Child(uint8 param)
{
    bit<param + 2> value;
};

struct Compound
{
    Child(0) child;
};

struct MissingCheck
{
     packed Compound compoundArray[];
};
  • Error
    Compound.write(zserio.runtime.array.PackingContext context, ...) doesn't have the check for the parameter param.

See in interactive compiler.

Expected behavior
The check is present and doesn't allow to serialize the data!

@Mi-La Mi-La added bug Something isn't working java Java language generator labels May 16, 2024
@Mi-La
Copy link
Contributor Author

Mi-La commented May 16, 2024

Note that the check is correctly present in files generated by Python and C++ generators. Consider to inspire by the implementation of one of them.

We shall introduce a language test which will assert that the exception is thrown when trying to serialize BLOB with invalid compound parameters.

@Mi-La Mi-La added this to the 2.15 milestone May 16, 2024
@Mi-La Mi-La self-assigned this May 29, 2024
Mi-La added a commit that referenced this issue May 30, 2024
@Mi-La Mi-La closed this as completed Jun 5, 2024
@mikir mikir modified the milestones: 2.15, 2.14.1 Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working java Java language generator
Projects
None yet
Development

No branches or pull requests

2 participants