-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
f-string position is miscomputed in multiple cases #5004
Labels
bug
Something isn't working
Comments
24 tasks
addisoncrump
changed the title
f-string single right brace position is miscomputed
f-string position is miscomputed
Jun 10, 2023
addisoncrump
changed the title
f-string position is miscomputed
f-string position is miscomputed in multiple cases
Jun 10, 2023
charliermarsh
pushed a commit
that referenced
this issue
Jun 12, 2023
Improves the `ruff_parse_simple` fuzz harness by adding checks for parsed locations to ensure they all lie on UTF-8 character boundaries. This will allow for faster identification of issues like #5004. This also adds additional details for Apple M1 users and clarifies the importance of using `init-fuzzer.sh` (thanks for the feedback, @jasikpark 🙂).
konstin
pushed a commit
that referenced
this issue
Jun 13, 2023
Improves the `ruff_parse_simple` fuzz harness by adding checks for parsed locations to ensure they all lie on UTF-8 character boundaries. This will allow for faster identification of issues like #5004. This also adds additional details for Apple M1 users and clarifies the importance of using `init-fuzzer.sh` (thanks for the feedback, @jasikpark 🙂).
Any idea if this is still true? |
I believe this is fixed. At least the offsets in the playground look correct https://play.ruff.rs/957af831-fd05-416e-8cff-e23cab5cca2a |
I don't have an example testcase presently, but if I come across one I'll reopen this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The position of errors is miscomputed in f-strings:
Moreover, it is not sound in the presence of carriage return + newline:
In rare cases, this may lead to a panic if multi-byte UTF-8 characters are present (carriage return + newline followed by UTF-8 char before mismatched
}
):Locator::after slices a source code snippet at the byte level. This may lead to an invalid UTF-8 slice if the index is in the middle of a code point, which occurs during f-string computation. This occurs in multiple f-string error types.
I am still searching for a root cause.
The text was updated successfully, but these errors were encountered: