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

@length() constraint applied incorrectly to strings not tagged with @dafnyUTF8Bytes #610

Open
robin-aws opened this issue Sep 24, 2024 · 0 comments
Labels
soundness Bugs that cause the generated code to compute the wrong value or crash

Comments

@robin-aws
Copy link
Contributor

The Dafny, C# and Java codegen all check the @Length constraints against the number of UTF-16 code points in the string, instead of the number of Unicode scalar values as they are supposed to.

The Constraints test model doesn't test this deeply enough to reveal it: it only uses ASCII test input. It does a better job on strings with @dafnyUTF8Bytes applied, and I believe all languages are implementing @Length correctly on those strings.

@robin-aws robin-aws added the soundness Bugs that cause the generated code to compute the wrong value or crash label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
soundness Bugs that cause the generated code to compute the wrong value or crash
Projects
None yet
Development

No branches or pull requests

1 participant