Harden common file helpers against null dereferences, fd 0 mishandling, and relative-path crashes#196
Draft
Copilot wants to merge 14 commits into
Draft
Harden common file helpers against null dereferences, fd 0 mishandling, and relative-path crashes#196Copilot wants to merge 14 commits into
Copilot wants to merge 14 commits into
Conversation
Co-authored-by: Amiga500 <16525337+Amiga500@users.noreply.github.com>
Co-authored-by: Amiga500 <16525337+Amiga500@users.noreply.github.com>
Co-authored-by: Amiga500 <16525337+Amiga500@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor bug hunting strategies for better efficiency
Fix off-by-one read in Mar 18, 2026
str_count_char
Co-authored-by: Amiga500 <16525337+Amiga500@users.noreply.github.com>
Co-authored-by: Amiga500 <16525337+Amiga500@users.noreply.github.com>
Copilot
AI
changed the title
Fix off-by-one read in
Harden shared string utilities against boundary and negative-time edge cases
Mar 18, 2026
str_count_charCo-authored-by: Amiga500 <16525337+Amiga500@users.noreply.github.com>
Copilot
AI
changed the title
Harden shared string utilities against boundary and negative-time edge cases
Harden shared string utilities against boundary and negative-input edge cases
Mar 18, 2026
Co-authored-by: Amiga500 <16525337+Amiga500@users.noreply.github.com>
Copilot
AI
changed the title
Harden shared string utilities against boundary and negative-input edge cases
Harden shared string utilities for empty-input, truncation, and negative-time edge cases
Mar 18, 2026
Co-authored-by: Amiga500 <16525337+Amiga500@users.noreply.github.com>
Co-authored-by: Amiga500 <16525337+Amiga500@users.noreply.github.com>
Copilot
AI
changed the title
Harden shared string utilities for empty-input, truncation, and negative-time edge cases
No-op PR: repository validation for unspecified issue
Mar 18, 2026
Co-authored-by: Amiga500 <16525337+Amiga500@users.noreply.github.com>
Co-authored-by: Amiga500 <16525337+Amiga500@users.noreply.github.com>
Copilot
AI
changed the title
No-op PR: repository validation for unspecified issue
Harden common file helpers against null dereferences and fd 0 misclassification
Mar 18, 2026
Co-authored-by: Amiga500 <16525337+Amiga500@users.noreply.github.com>
Co-authored-by: Amiga500 <16525337+Amiga500@users.noreply.github.com>
Copilot
AI
changed the title
Harden common file helpers against null dereferences and fd 0 misclassification
Harden common file helpers against null dereferences, fd 0 mishandling, and relative-path crashes
Mar 18, 2026
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.
This change addresses several severe bugs in the shared file utility layer. The failures were concentrated in
src/common/utils/file.c: unsafe error paths in file I/O and a crash path when prepending to files addressed by relative path.Safer
file_read()/file_write()behaviorfile_read()now returnsNULLonfopen()or allocation failure instead of falling through into invalid buffer access.file_write()now:open()failure as-1instead of misclassifying valid fd0Fix relative-path crash in
file_add_line_to_beginning()/correctly instead of dereferencing aNULLdirname.sprintf()with boundedsnprintf()when constructing the temporary path.Focused regression coverage
file.c.0reuse duringfile_write()💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.