Skip to content
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

fix fuzzed issue in gix-config #1241

Merged
merged 1 commit into from
Jan 8, 2024
Merged

fix fuzzed issue in gix-config #1241

merged 1 commit into from
Jan 8, 2024

Conversation

Byron
Copy link
Member

@Byron Byron commented Jan 8, 2024

Now we won't read more than 1024 newlines in a row, which leads to
a protection from specifically crafted configuration files which
can amplify themselves when large amounts of edits happen on them.

If somebody where to create a lot of sections based on one that
has a huge amount of newlines before it, this whitespace would
be retained with each new section, causing huge files to be created
in memory that cause great delays when writing the file back
and re-reading it.

Maybe there would have been a way to avoid copying excessive amounts
of whitespace when altering a section, or maybe one could also
have adjusted the fuzz-test that found it 1.
This would, however, have been much harder and time-consuming to
implement for dubious value.

Now we won't read more than 1024 newlines in a row, which leads to
a protection from specifically crafted configuration files which
can amplify themselves when large amounts of edits happen on them.

If somebody where to create a lot of sections based on one that
has a huge amount of newlines before it, this whitespace would
be retained with each new section, causing huge files to be created
in memory that cause great delays when writing the file back
and re-reading it.

Maybe there would have been a way to avoid copying excessive amounts
of whitespace when altering a section, or maybe one could also
have adjusted the fuzz-test that found it [1].
This would, however, have been much harder and time-consuming to
implement for dubious value.

[1]: https://oss-fuzz.com/testcase?key=6416843954782208
@Byron Byron merged commit b382f76 into main Jan 8, 2024
18 checks passed
@Byron Byron deleted the fix-fuzzed branch January 8, 2024 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant