-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WGSL] Unterminated block comments crash the lexer
https://bugs.webkit.org/show_bug.cgi?id=259661 rdar://113161516 Reviewed by Dan Glastonbury. In Lexer::skipBlockComments, we need to check if we are at the end of the file before we shift. I also had to tweak the parser since it would ignore the first token if it's the only token. This happens because we call `lex()` when constructing the parser and then check if the lexer is at the end of the file, instead of the checking the token produced by `lex()`. * Source/WebGPU/WGSL/Lexer.cpp: (WGSL::Lexer<T>::lex): (WGSL::Lexer<T>::shift): (WGSL::Lexer<T>::skipBlockComments): (WGSL::Lexer<T>::skipWhitespaceAndComments): * Source/WebGPU/WGSL/Lexer.h: * Source/WebGPU/WGSL/Parser.cpp: (WGSL::Parser<Lexer>::parseShader): * Source/WebGPU/WGSL/tests/invalid/unterminated-comment.wgsl: Added. Canonical link: https://commits.webkit.org/266476@main
- Loading branch information
1 parent
f71ea9e
commit 65d4092
Showing
4 changed files
with
20 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// RUN: %not %wgslc | ||
|
||
/* |