Skip to content

v4.4.23

Choose a tag to compare

@xalgord xalgord released this 29 May 11:32
· 78 commits to main since this release

Changes

  • fix: slice bounds panic in rewriteShellSegments with multi-byte UTF-8 commands

Root Cause

rewriteShellSegments used for i, r := range command which yields byte offsets, but peek-ahead operations (command[i+1]) assumed 1-byte runes. Multi-byte UTF-8 characters (em-dashes, accented chars, emoji, IDN domains) before shell delimiters (|, ||, &&, ;) caused inverted slice bounds → panic.

Fix

Replaced range iteration with explicit byte-index stepping via utf8.DecodeRuneInString, ensuring all peek-ahead and slicing use consistent byte offsets.

Tests

Added 6 regression tests covering em-dashes, curly quotes, IDN domains, accented characters, emoji, and long multi-byte strings.