-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: use block comments in CR mutator to prevent compilation errors #2830
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
base: master
Are you sure you want to change the base?
fix: use block comments in CR mutator to prevent compilation errors #2830
Conversation
Line comments (//) break compilation when code continues after the commented portion on the same line. Block comments (/* */) work in all cases. Also include trailing semicolon in comment when present, preventing orphaned semicolon syntax errors like `/* stmt */;`.
c7ae8ab to
f6bacf4
Compare
Resolves merge conflict in tests/tools/mutator/test_mutator.py by keeping both: - CR mutator block comments test (from this branch) - Target selector parsing tests (from upstream/dev)
0ccdbb6 to
f1d994e
Compare
Code reviewFound 1 issue:
slither/slither/tools/mutator/mutators/CR.py Lines 31 to 36 in 3fa85c3
The fix should encode the source code to UTF-8 bytes before indexing, similar to how source_bytes = self.slither.source_code[self.in_file].encode("utf8")
if stop < len(source_bytes) and source_bytes[stop:stop+1] == b";":Reference: slither/slither/core/source_mapping/source_mapping.py Lines 71 to 89 in fd71cab
🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Summary
CR mutator now uses block comments (
/* */) instead of line comments (//).Problem
Line comment
//comments out everything after it on the line. This breaks compilation when code continues:Solution
Scenarios Improved
Function modifier same line as brace:
Single-line functions: