Skip to content

Conversation

Teapot4195
Copy link
Contributor

@Teapot4195 Teapot4195 commented Sep 22, 2025

When the less fortunate recovery path for frontmatters are taken, if the lexer considers more than one possible frontmatter closing possibility, the current index is entirely mis-tracked and can result in bump_bytes landing in the middle of a multichar unicode character.

This fixes it by tracking the actual base index and updating it as it considers additional closing possibilities.

fixes #146847

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 22, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 22, 2025

r? @nnethercote

rustbot has assigned @nnethercote.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@fmease
Copy link
Member

fmease commented Sep 22, 2025

Could you please add a regression test? In tests/ui/frontmatter/

@Teapot4195
Copy link
Contributor Author

Could you please add a regression test? In tests/ui/frontmatter/

First time writing tests, naming/contents ok?

@nnethercote
Copy link
Contributor

Thank you, @Teapot4195!

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Sep 22, 2025

📌 Commit 2d18c88 has been approved by nnethercote

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 22, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 23, 2025
…thercote

Fix a crash/mislex when more than one frontmatter closing possibility is considered

When the less fortunate recovery path for frontmatters are taken, if the lexer considers more than one possible frontmatter closing possibility, the current index is entirely mis-tracked and can result in bump_bytes landing in the middle of a multichar unicode character.

This fixes it by tracking the actual base index and updating it as it considers additional closing possibilities.

fixes rust-lang#146847
bors added a commit that referenced this pull request Sep 23, 2025
Rollup of 13 pull requests

Successful merges:

 - #146632 (Fix uses of "adaptor")
 - #146731 (test: Use SVG for terminal url test)
 - #146775 (fixes for numerous clippy warnings)
 - #146784 ([win] Use find-msvc-tools instead of cc to find the linker and rc on Windows)
 - #146799 (Fix a dangling reference in `rustc_thread_pool`)
 - #146802 (mbe: Simplifications and refactoring)
 - #146806 (add private module override re-export test)
 - #146827 (Linker-plugin-based LTO: update list of good combinations (inc. beta + nightly))
 - #146875 (tests/run-make/crate-loading: Rename source files for clarity)
 - #146896 (rustc-dev-guide subtree update)
 - #146898 (Update books)
 - #146899 (Fix a crash/mislex when more than one frontmatter closing possibility is considered)
 - #146907 (add regression test for issue 146537)

r? `@ghost`
`@rustbot` modify labels: rollup
Kobzol added a commit to Kobzol/rust that referenced this pull request Sep 23, 2025
…thercote

Fix a crash/mislex when more than one frontmatter closing possibility is considered

When the less fortunate recovery path for frontmatters are taken, if the lexer considers more than one possible frontmatter closing possibility, the current index is entirely mis-tracked and can result in bump_bytes landing in the middle of a multichar unicode character.

This fixes it by tracking the actual base index and updating it as it considers additional closing possibilities.

fixes rust-lang#146847
bors added a commit that referenced this pull request Sep 23, 2025
Rollup of 8 pull requests

Successful merges:

 - #146632 (Fix uses of "adaptor")
 - #146731 (test: Use SVG for terminal url test)
 - #146775 (fixes for numerous clippy warnings)
 - #146802 (mbe: Simplifications and refactoring)
 - #146875 (tests/run-make/crate-loading: Rename source files for clarity)
 - #146896 (rustc-dev-guide subtree update)
 - #146898 (Update books)
 - #146899 (Fix a crash/mislex when more than one frontmatter closing possibility is considered)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 23, 2025
…thercote

Fix a crash/mislex when more than one frontmatter closing possibility is considered

When the less fortunate recovery path for frontmatters are taken, if the lexer considers more than one possible frontmatter closing possibility, the current index is entirely mis-tracked and can result in bump_bytes landing in the middle of a multichar unicode character.

This fixes it by tracking the actual base index and updating it as it considers additional closing possibilities.

fixes rust-lang#146847
bors added a commit that referenced this pull request Sep 23, 2025
Rollup of 8 pull requests

Successful merges:

 - #146818 (constify {float}::total_cmp())
 - #146896 (rustc-dev-guide subtree update)
 - #146898 (Update books)
 - #146899 (Fix a crash/mislex when more than one frontmatter closing possibility is considered)
 - #146904 (#140368 Mutex/RwLock/ReentrantLock::data_ptr to be const fn)
 - #146907 (add regression test for issue 146537)
 - #146927 (Make it possible to `x install` Cranelift and LLVM bitcode linker)
 - #146931 (miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Sep 24, 2025
Rollup of 6 pull requests

Successful merges:

 - #146818 (constify {float}::total_cmp())
 - #146896 (rustc-dev-guide subtree update)
 - #146898 (Update books)
 - #146899 (Fix a crash/mislex when more than one frontmatter closing possibility is considered)
 - #146904 (#140368 Mutex/RwLock/ReentrantLock::data_ptr to be const fn)
 - #146907 (add regression test for issue 146537)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 24, 2025
…thercote

Fix a crash/mislex when more than one frontmatter closing possibility is considered

When the less fortunate recovery path for frontmatters are taken, if the lexer considers more than one possible frontmatter closing possibility, the current index is entirely mis-tracked and can result in bump_bytes landing in the middle of a multichar unicode character.

This fixes it by tracking the actual base index and updating it as it considers additional closing possibilities.

fixes rust-lang#146847
bors added a commit that referenced this pull request Sep 24, 2025
Rollup of 6 pull requests

Successful merges:

 - #146818 (constify {float}::total_cmp())
 - #146896 (rustc-dev-guide subtree update)
 - #146898 (Update books)
 - #146899 (Fix a crash/mislex when more than one frontmatter closing possibility is considered)
 - #146904 (#140368 Mutex/RwLock/ReentrantLock::data_ptr to be const fn)
 - #146907 (add regression test for issue 146537)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Sep 24, 2025
Rollup of 6 pull requests

Successful merges:

 - #146818 (constify {float}::total_cmp())
 - #146896 (rustc-dev-guide subtree update)
 - #146898 (Update books)
 - #146899 (Fix a crash/mislex when more than one frontmatter closing possibility is considered)
 - #146904 (#140368 Mutex/RwLock/ReentrantLock::data_ptr to be const fn)
 - #146907 (add regression test for issue 146537)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit f984966 into rust-lang:master Sep 24, 2025
10 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Sep 24, 2025
rust-timer added a commit that referenced this pull request Sep 24, 2025
Rollup merge of #146899 - Teapot4195:issue-146847-fix, r=nnethercote

Fix a crash/mislex when more than one frontmatter closing possibility is considered

When the less fortunate recovery path for frontmatters are taken, if the lexer considers more than one possible frontmatter closing possibility, the current index is entirely mis-tracked and can result in bump_bytes landing in the middle of a multichar unicode character.

This fixes it by tracking the actual base index and updating it as it considers additional closing possibilities.

fixes #146847
Muscraft pushed a commit to Muscraft/rust that referenced this pull request Sep 24, 2025
…thercote

Fix a crash/mislex when more than one frontmatter closing possibility is considered

When the less fortunate recovery path for frontmatters are taken, if the lexer considers more than one possible frontmatter closing possibility, the current index is entirely mis-tracked and can result in bump_bytes landing in the middle of a multichar unicode character.

This fixes it by tracking the actual base index and updating it as it considers additional closing possibilities.

fixes rust-lang#146847
Muscraft pushed a commit to Muscraft/rust that referenced this pull request Sep 24, 2025
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#146818 (constify {float}::total_cmp())
 - rust-lang#146896 (rustc-dev-guide subtree update)
 - rust-lang#146898 (Update books)
 - rust-lang#146899 (Fix a crash/mislex when more than one frontmatter closing possibility is considered)
 - rust-lang#146904 (rust-lang#140368 Mutex/RwLock/ReentrantLock::data_ptr to be const fn)
 - rust-lang#146907 (add regression test for issue 146537)

r? `@ghost`
`@rustbot` modify labels: rollup
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Sep 26, 2025
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#146818 (constify {float}::total_cmp())
 - rust-lang/rust#146896 (rustc-dev-guide subtree update)
 - rust-lang/rust#146898 (Update books)
 - rust-lang/rust#146899 (Fix a crash/mislex when more than one frontmatter closing possibility is considered)
 - rust-lang/rust#146904 (rust-lang/rust#140368 Mutex/RwLock/ReentrantLock::data_ptr to be const fn)
 - rust-lang/rust#146907 (add regression test for issue 146537)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE caused by ill-formed frontmatter
5 participants