You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(linter): prevent integer underflow in count_comment_lines for JSX comments
When processing JSX inline comments like `{/* comment */}` with the
eslint/max-lines rule using skipComments: true, the count_comment_lines
function would calculate start_line > end_line, causing integer underflow.
This resulted in:
- Debug mode: panic with "attempt to subtract with overflow"
- Release mode: wrapping to usize::MAX, incorrect line count
Fix by using saturating_sub which:
- Prevents panic in all build modes
- Returns 0 for inline comments (logically correct)
- Maintains correct behavior for multi-line comments
Added test case to prevent regression.
0 commit comments