Repository navigation
Buffer overruns and encodings - #19471
Merged
Merged
Conversation
niik
marked this pull request as ready for review
October 30, 2024 11:14
Base automatically changed from
remove-spawnandcomplete
to
expose-encoding-overloads
November 5, 2024 10:05
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Builds on top of #19470
This fixes a bug where if a user attempts to view the diff for a file which is greater than 256kb (note that the diff may be smaller) we will fail to perform any syntax highlighting of said file.
This is because the
maxBufferargument to execFile will throw an error if the stdout (or stderr) output exceeds the limit but that error will include the partial output collected up until the limit.A good way to test this is to make a change in our
changelog.json(which is ~300k) and observe that the diff is not highlighted and that there's an error message in the console. This was accidentally introduced in 840bbf5 which made getPartialBlobContentsCatchPathNotInRef usegit(i.e. execFile) rather thanspawnAndCompletewhich handled buffer overruns.The whole reason for having this limit in the first place is so that we don't spend unbound time in CodeMirror's language parser trying to highlight enormous files. So a change made to a file after the first 256kb will not be highlighted and that's expected behavior.
Screenshots
Release notes
Notes: