π‘οΈ Sentinel: Fix SIGBUS on input/output path collision#3
π‘οΈ Sentinel: Fix SIGBUS on input/output path collision#3
Conversation
- π¨ Severity: CRITICAL - π‘ Vulnerability: A SIGBUS crash occurs when the output file path is the same as the input file path. - π― Impact: Opening the output file for writing truncates the input file while it is still memory-mapped, causing the application to crash immediately with a Bus Error (SIGBUS). - π§ Fix: Use \`std::fs::canonicalize\` to verify that input and output file paths are distinct before opening the output file. - β Verification: Verified with a reproduction script that formerly crashed and now reports a proper error message. All existing tests pass. Co-authored-by: kassoulet <1905+kassoulet@users.noreply.github.com>
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
This PR fixes a critical vulnerability where the application would crash with a SIGBUS signal if the user accidentally specified the same file for both input and output. This happened because the input file is memory-mapped for high-performance processing, and opening it again for writing (with truncation) invalidated the memory mapping.
The fix involves:
mainfunction.std::fs::canonicalizeto compare the absolute paths of the input and output files.This change is under 50 lines and follows the security requirements for the project.
PR created automatically by Jules for task 15379727575619323244 started by @kassoulet