Crash in clang::TextDiagnostic::emitSnippetAndCaret for invalid expression
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
- crash on invalid, found from fuzzing
- crashes current assertion build
- error does not occur when using the -w flag
- the last character is non-ASCII
Minimized Code
```
Hex ASCII
5b38 3c3c 382b 3228 2e00 [8<<8+2(..
```
Minimzed C File:
[minimized_crash_file.c](https://github.com/user-attachments/files/25493414/minimized_crash_file.c)
Full C File:
[full_crash_input.c](https://github.com/user-attachments/files/25493157/full_crash_input.c)
CompilerExplorer:
https://godbolt.org/z/j7cddEM4o
Contributor guide
Research direction
Reproduce the crash with minimized_crash_file.c using an assertion build of Clang, and compare it with the -w behavior and CompilerExplorer link. Start in clang::TextDiagnostic::emitSnippetAndCaret, focusing on the invalid expression whose final character is non-ASCII. Done means the diagnostic no longer crashes for the minimized input and the existing diagnostic behavior remains covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100