Repository navigation
fix(relinker): reject outputs that overwrite the input file - #356
Closed
nicolasabosch wants to merge 1 commit into
Closed
nicolasabosch wants to merge 1 commit into
nicolasabosch wants to merge 1 commit into
Conversation
9 tasks done
9 tasks done
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.
What
The relinker can overwrite its source ELF when the output identifies the input file. For example,
relinker --skip-sce-module --windows input.elf input.elfcurrently succeeds and replaces the original ELF with a PE executable.Reject that output using C++20
std::filesystem::equivalentbefore conversion or artifact writes. Distinct output files, including existing files, remain valid. Add and register a real-binary regression test covering identical paths, relative/absolute and normalized aliases, hard links, symlinks when supported, and case aliases on case-insensitive Windows filesystems. Both Linux ELF and Windows PE output modes are covered; rejection preserves input bytes and creates no registry artifact.Tested
core/relinker/CMakeLists.txtusing a temporary CMake harness outside the repository. The harness sets C++20, enables testing, defines the rootadd_test_executablehelper, and adds the unchanged relinker subdirectory. The full runtime/library build and the documented MinGW toolchain were not tested locally.ctest --test-dir work/relinker-build --output-on-failure: 16/16 passed. Hard-link, symlink and Windows case-alias cases ran without skips.git diff --check: passed.Checklist
main; no other open PR implements the same functions (95 open PRs checked).mdfiles or images added to the repository