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

Bug [rlwe]: rlwe.Parameters.ReadFrom fails (PR #456) #459

Closed
Pro7ech opened this issue May 2, 2024 · 0 comments · Fixed by #474
Closed

Bug [rlwe]: rlwe.Parameters.ReadFrom fails (PR #456) #459

Pro7ech opened this issue May 2, 2024 · 0 comments · Fixed by #474
Labels
bug Something isn't working

Comments

@Pro7ech
Copy link
Contributor

Pro7ech commented May 2, 2024

#456 added WriteTo and ReadFrom to the rlwe.Parameters without adding associated tests and it actually fails when calling .ReadFrom.
This can be easily reproduced by testing the serialization of rlwe.Parameters with the method buffer.RequireSerializerCorrect, which returns the error: unexpected end of JSON input.

This happens because .BinarySize() is called on empty parameters by ReadFrom to get the number of bytes to read. But this returns the wrong size because the serialization size of rlwe.Parameters is dependant on the content of the struct.

-> Do like other content-dependent structs (e.g. ring.Poly): add a 4/8 bytes prefix with the number of bytes to read

@Pro7ech Pro7ech added the bug Something isn't working label May 2, 2024
@Pro7ech Pro7ech changed the title Bug [rlwe]: rlwe.Parameters serialization due to PR #456 Bug [rlwe]: rlwe.Parameters.ReadFrom fails due to PR #456 May 2, 2024
@Pro7ech Pro7ech changed the title Bug [rlwe]: rlwe.Parameters.ReadFrom fails due to PR #456 Bug [rlwe]: rlwe.Parameters.ReadFrom fails (PR #456) May 2, 2024
@romainbou romainbou linked a pull request Jun 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant