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

UTF-8 Error: index is not a char boundary #14895

Closed
jkomyno opened this issue Aug 19, 2022 · 1 comment · Fixed by prisma/prisma-engines#3457
Closed

UTF-8 Error: index is not a char boundary #14895

jkomyno opened this issue Aug 19, 2022 · 1 comment · Fixed by prisma/prisma-engines#3457
Assignees
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/schema Issue for team Schema. tech/engines/formatter engine Issue in the Formatter Engine topic: error reporting Issues created via Prisma's CLI Crash Reporting topic: prisma format CLI: prisma format
Milestone

Comments

@jkomyno
Copy link
Contributor

jkomyno commented Aug 19, 2022

Command: prisma format
Version: 4.1.1
Binary Version: 8d8414deb360336e4698a65aa45a1fbaf1ce13d8
Report: https://prisma-errors.netlify.app/report/14219
OS: arm64 darwin 21.6.0

@jkomyno jkomyno added kind/bug A reported bug. topic: prisma format CLI: prisma format topic: error reporting Issues created via Prisma's CLI Crash Reporting team/schema Issue for team Schema. tech/engines/formatter engine Issue in the Formatter Engine process/candidate labels Aug 19, 2022
@janpio janpio added the bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. label Aug 20, 2022
@tomhoule tomhoule self-assigned this Nov 30, 2022
@tomhoule
Copy link
Contributor

This is a very specific code path, multi-byte characters in comments in general are completely fine.

tomhoule added a commit to prisma/prisma-engines that referenced this issue Nov 30, 2022
When adding an @relation attribute to a forward relation field in the
relation reformatting code that deals with adding missing relation
fields and attributes, we searched for the last character before a
newline to check whether it is a carriage return, but we failed to
check whether the byte offset was a char boundary first. This caused
crashes.

closes prisma/prisma#14895
tomhoule added a commit to prisma/prisma-engines that referenced this issue Dec 1, 2022
When adding an @relation attribute to a forward relation field in the
relation reformatting code that deals with adding missing relation
fields and attributes, we searched for the last character before a
newline to check whether it is a carriage return, but we failed to
check whether the byte offset was a char boundary first. This caused
crashes.

closes prisma/prisma#14895
@Jolg42 Jolg42 added this to the 4.8.0 milestone Dec 1, 2022
tomhoule added a commit to prisma/prisma-engines that referenced this issue Dec 1, 2022
When adding an @relation attribute to a forward relation field in the
relation reformatting code that deals with adding missing relation
fields and attributes, we searched for the last character before a
newline to check whether it is a carriage return, but we failed to
check whether the byte offset was a char boundary first. This caused
crashes.

closes prisma/prisma#14895
tomhoule added a commit to prisma/prisma-engines that referenced this issue Dec 1, 2022
When adding an @relation attribute to a forward relation field in the
relation reformatting code that deals with adding missing relation
fields and attributes, we searched for the last character before a
newline to check whether it is a carriage return, but we failed to
check whether the byte offset was a char boundary first. This caused
crashes.

This commit fixes the problem by adding the relation attribute directly after the field type, rather than walking back from the end of the field (including trailing comment). We could do better with a proper AST.

closes prisma/prisma#14895
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/schema Issue for team Schema. tech/engines/formatter engine Issue in the Formatter Engine topic: error reporting Issues created via Prisma's CLI Crash Reporting topic: prisma format CLI: prisma format
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants