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

PyRFLX simplification of Div expressions incomplete #981

Closed
rssen opened this issue Apr 8, 2022 · 1 comment
Closed

PyRFLX simplification of Div expressions incomplete #981

rssen opened this issue Apr 8, 2022 · 1 comment
Labels
bug pyrflx Related to pyrflx package (Legacy Python API)

Comments

@rssen
Copy link
Contributor

rssen commented Apr 8, 2022

Parsing a message for the below specification results the following error.

AssertionError: unresolved field conditions in Test.Fld_B: 23 / 8 /= 15 / 8, 23 / 8 = 15 / 8
package Test is

   type A is mod 2 ** 8;
   type B is mod 2 ** 8;
   type C is mod 2 ** 8;

   type Test is
      message
         Fld_A : A;
         Fld_B : B
            then Fld_C
               if Message'Last / 8 = Fld_B'Last / 8
            then null
               if Message'Last / 8 /= Fld_B'Last / 8;
         Fld_C : C;
      end message;

end Test;

The error occurs because the simplified() method of expression.Div calling the __floordiv__() method of the Number class does not return the result of the division operation, but instead a new Div object that is similar to the one that the operation was performed on, if the result of the division would not be an integer.

This error can also be observed when parsing a TLS handshake client hello message, where the following portion of the specification results in the assertion error:

Legacy_Compression_Methods : Opaque
    with Size => Legacy_Compression_Methods_Length * 8
    then null
       if Message'Last / 8 = Legacy_Compression_Methods'Last / 8
    then Extensions_Length
       if Message'Last / 8 /= Legacy_Compression_Methods'Last / 8;
@rssen rssen added bug pyrflx Related to pyrflx package (Legacy Python API) labels Apr 8, 2022
@treiher treiher added this to To do in RecordFlux 0.6 via automation Apr 8, 2022
@senier senier removed this from To do in RecordFlux 0.6 Aug 23, 2022
@senier senier added this to To do in RecordFlux Future via automation Aug 23, 2022
@treiher
Copy link
Collaborator

treiher commented Mar 26, 2024

This bug has been fixed. The fix will be part of 0.20.0.

@treiher treiher closed this as completed Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug pyrflx Related to pyrflx package (Legacy Python API)
Projects
No open projects
Development

No branches or pull requests

2 participants