-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Detect malformed UTF-8 files and refuse to engage further #53667
Conversation
I'm paranoid @typescript-bot test this |
Heya @jakebailey, I've started to run the diff-based top-repos suite on this PR at 0c78667. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the extended test suite on this PR at 0c78667. You can monitor the build here. |
Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at 0c78667. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the diff-based user code test suite (tsserver) on this PR at 0c78667. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the abridged perf test suite on this PR at 0c78667. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at 0c78667. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the diff-based top-repos suite (tsserver) on this PR at 0c78667. You can monitor the build here. Update: The results are in! |
@jakebailey Here are the results of running the user test suite comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
@jakebailey Here are the results of running the user test suite comparing Everything looks good! |
@jakebailey Here they are:Comparison Report - main..53667
System
Hosts
Scenarios
Developer Information: |
Hey @jakebailey, the results of running the DT tests are ready. |
@jakebailey Here are the results of running the top-repos suite comparing Everything looks good! |
1 similar comment
@jakebailey Here are the results of running the top-repos suite comparing Everything looks good! |
# Conflicts: # src/compiler/diagnosticMessages.json # tests/baselines/reference/api/tsserverlibrary.d.ts # tests/baselines/reference/api/typescript.d.ts
Belt-and-suspenders on #53114.
When a file is actually binary, or at least starts with invalid UTF-8 bytes, it's not going to be a good use of our time to try to make sense of it. This PR detects U+FFFD REPLACEMENT CHARACTER in the leading character position and, if encountered, skips to the end of the file.
This fully mitigates both the crashes caused by these enormous binaries effectively fuzzing our parser, as well as the performance penalty of generating e.g. 54,000 errors on a 1.8 MB "JS" file that is actually just line noise.
The "corrupted.ts" file is the verbatim first eight bytes of a repro we got for this.