Skip to content

[bug] Control byte 0x1C from $'\c\' reaches child argv as U+E000+U+E01D PUA carrier pair (0x01/0x7F pass raw) #199

Closed

Description

@caomengxuan666

Found by the suite2 ledger run (exp suite, exp1.sub lines 52-53), WSL GNU Bash 5.3.0 baseline. Distinct trigger from #141 (invalid-UTF-8 bytes) and #187 (CTLESC \x11 in mixed-quote comsub words) — here a plain ANSI-C $'...' word with NO comsub and NO mixed quotes.

Repro (LF script, both sides; recho caret-izes control bytes)

recho $'\c\001 \c\177'
recho $'\cA \c?'

GNU Bash 5.3.0

argv[1] = <^\001 ^\177>      (arg bytes: 0x1C '0''0''1' 0x1C '1''7''7')
argv[1] = <^A ^?>            (arg bytes: 0x01 0x20 0x7F)

rubash (target-wire/debug/rubash.exe, master 26728da)

argv[1] = <EE 80 80 EE 80 9D 001 EE 80 80 EE 80 9D 177>   (U+E000 U+E01D leak for each 0x1C)
argv[1] = <^A ^?>            (0x01 and 0x7F arrive raw — correct)

Byte 0x1C produced by the ANSI-C \c\ (control-backslash) escape is carried as the PUA pair U+E000+U+E01D all the way into the child process command line, instead of being decoded back to the raw byte at exec time. 0x1F (from \c+DEL) leaks the same way in the exp suite artifacts (output line 296: argv[1] = <^A ^_> vs mojibake). 0x01 and 0x7F pass through correctly, so the decode path misses only part of the C0 range. This is the documented highest-risk carrier area: carriers must be stripped when building external argv.

GNU anchor

  • parse.y:5694-5706 got_character vs got_escaped_character — where CTLESC/CTLNUL protection is applied
  • subst.c:4807 dequote_string() — final dequote before argv assembly
  • subst.c:13219 expand_word_list_internal() — word list handed to execute_disk_command

Artifacts

Activity

  1. added
    bug
    gnu-baseline
    on Sep 27, 2026
  2. caomengxuan666 commented on Sep 27, 2026

    @caomengxuan666
    MemberAuthor

    Verified FIXED at current master-side branch point (wt2/alias base 62c7e5f), by the raw-byte argv/storage boundary work (efdfed8 "env-triage/bytes", 0f49ec0 #141 family) — no further change needed.

    Re-verified byte-for-byte against WSL GNU Bash 5.3.0 (/usr/local/bin/bash) from LF script files, on both a clean 62c7e5f build and 0acba228:

    • The issue's exact repro (recho via a real helper process, byte-level port of third_party/bash/support/recho.c):
      • recho $'\c\001 \c\177' → argv[1] = <^\001 ^\177> (GNU identical; arg bytes 0x1C '0''0''1' 0x1C '1''7''7', no U+E000/U+E01D)
      • recho $'\cA \c?' → argv[1] = <^A ^?>
    • Full C0 matrix through $'...' into child argv AND variable storage: \cA..\cZ (0x01-0x1A), \c[ (0x1B), \c] \c^ \c_ (0x1D-0x1F), \c? (0x7F), plus \c\ written as $'\c\1' direct-word and via a variable — every byte arrives raw in child argv (checked through two independent children: coreutils printf and the recho helper) and in storage. Output identical to GNU on all rows.

    Remaining rubash-side exp suite diffs in this environment are the missing harness recho.exe (wslpath build failure — the rubash side of those suites has no recho at all on BOTH the baseline and patched trees, identical ledger counts), i.e. environment-bound, not this carrier family.

    Probe/matrix evidence retained at target/issue-suites/results/true-baseline/ (83-suite ledger identical before/after the wt2/alias carrier changes).

  3. caomengxuan666 commented on Sep 27, 2026

    @caomengxuan666
    MemberAuthor

    验证后确认已由此前落地的工作修复(commit 0f49ec0 原始字节 argv 边界 + efdfed8 U+E000 载体对绕过字符级解码):字节级 recho 探针 + 全 C0 矩阵(0x01-0x1F、0x7F,\cA..\c? 全拼法,直词/经变量/两级子进程 argv)与 WSL GNU 5.3.0 字节一致。予以关闭。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggnu-baseline

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions