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 root cause: update idx when newHost replaces _string
Per @MihaZupan's feedback, instead of adding defensive bounds checking everywhere,
fix the root cause where the IndexMask offset becomes invalid after bidi character
removal.
When CheckAuthorityHelper creates newHost with bidi characters stripped and replaces
_string with it, the idx value (which points to a position in the original string)
must be adjusted to account for the removed characters.
The adjustment: idx -= (originalLength - newHost.Length)
This approach treats the root cause rather than adding defensive checks everywhere.
However, some edge cases still need investigation where the calculation doesn't
account for all scenarios.
Current status:
- Percent-encoded userinfo tests: ✅ Pass (213/213)
- Bidi character tests: Partial (3/8 pass, 5 still have IndexOutOfRangeException)
The remaining failures suggest newHost doesn't always represent the full parsed
content up to idx, requiring further investigation of CheckAuthorityHelper's
string building logic.
Co-authored-by: MihaZupan <[email protected]>
0 commit comments