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

Fix crash on multibyte char in page ranges #241 #242

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wrenger
Copy link

@wrenger wrenger commented Oct 22, 2024

This fixes #241, which is a bug caused by incorrectly splitting the page ranges into groups.
The index calculation fails to account for a multibyte character at the end of a pages group. The subsequent split operation on the incorrect index leads to a crash, as described in the issue.

Examples:

@article{foo,
  ...
  pages     = {321--},
  ...
}
@article{bar,
  ...
  pages     = {321–},
  ...
}

Both page ranges are converted to a 321 followed by , which is an utf8 character with multiple bytes

In addition to the fix, I've added a few tests for this and removed the string window in favor of the chars iterator from the std.

@wrenger
Copy link
Author

wrenger commented Nov 1, 2024

Hi, seems pretty quiet around this repo. The focus is currently probably on the Typst compiler itself?

As this bug crashes the Typst compiler on valid BibTeX, it's quite critical for me, and I would be happy if it is fixed 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[0.12.0] Compiler Crash at BibTeX Items with Open pages Range
1 participant