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

Incorrect simplification #221

Closed
d-xo opened this issue Mar 13, 2023 · 1 comment
Closed

Incorrect simplification #221

d-xo opened this issue Mar 13, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@d-xo
Copy link
Collaborator

d-xo commented Mar 13, 2023

The following expression is simplified down into a non equivalent expression:

ReadByte (Lit 0x1b) (CopySlice (Lit 0x58) (Sub (Lit 0x2e) (Lit 0x40)) (Lit 0x42) (AbstractBuf "esc_drxeJBJlnuTyjoGzkYZ") (AbstractBuf "esc_LmFwbKsRDIMCCxoqkYdzYXFiEEMwrgrrrxayeUmDpVYFLJfWSEtyOFxWMcL"))

This was discovered by the fuzzer during a CI run.

@d-xo d-xo added bug Something isn't working soundness labels Mar 13, 2023
@msooseth
Copy link
Collaborator

This is now correct:

ghci> Expr.simplify (ReadByte (Lit 0x1b) (CopySlice (Lit 0x58) (Sub (Lit 0x2e) (Lit 0x40)) (Lit 0x42) (AbstractBuf "esc_drxeJBJlnuTyjoGzkYZ") (AbstractBuf "esc_LmFwbKsRDIMCCxoqkYdzYXFiEEMwrgrrrxayeUmDpVYFLJfWSEtyOFxWMcL")))
ReadByte (Lit 0x85) (AbstractBuf "esc_drxeJBJlnuTyjoGzkYZ")
ghci> 0x85
133

And indeed:

ghci> W256 (0x0-0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee)
0x12
ghci> 0x1b+0x12+0x58
133

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

No branches or pull requests

2 participants