File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -508,6 +508,8 @@ token_t lex_token_internal(bool aliasing)
508508 token_str [i - 1 ] = next_char ;
509509 }
510510 } else {
511+ if (i >= MAX_TOKEN_LEN - 1 )
512+ error ("String literal too long" );
511513 token_str [i ++ ] = next_char ;
512514 }
513515 if (next_char == '\\' )
Original file line number Diff line number Diff line change @@ -3659,6 +3659,21 @@ int main() {
36593659}
36603660EOF
36613661
3662+ # String literal and escape coverage (additional)
3663+ try_output 0 " AZ" << 'EOF '
3664+ int main() {
3665+ printf("%s", "\\x41Z"); /* hex escape then normal char */
3666+ return 0;
3667+ }
3668+ EOF
3669+
3670+ try_output 0 " AZ" << 'EOF '
3671+ int main() {
3672+ printf("%s", "A\\132"); /* octal escape for 'Z' */
3673+ return 0;
3674+ }
3675+ EOF
3676+
36623677# Cast zero value
36633678try_ 0 << EOF
36643679int main() {
You can’t perform that action at this time.
0 commit comments