Skip to content

[bug] $'...' out-of-range \\U / lone-surrogate \\u emit internal-marker bytes (U+E000 family) #1234

Closed

Description

@caomengxuan666

[bug] $'...' out-of-range \\U / lone-surrogate \\u emit internal-marker bytes (U+E000 family)

Valid escapes match GNU; only the invalid ones diverge, and niu's output contains ee 80 80 (= U+E000, the internal marker from #1060) repeated:

printf '%s' $'\U00110000' | od -An -tx1
# GNU:  f4 90 80 80            (encodes the codepoint as-is)
# niu:  ee 80 80 ee 83 b5 ee 80 80 ee 82 91 ... (marker garbage)
printf '%s' $'\uD800' | od -An -tx1
# GNU:  ed a0 80               (WTF-8 lone surrogate)
# niu:  ee 80 80 ee 83 ae ... (marker garbage)
printf '%s' $'\U0010FFFF' | od -An -tx1
# both: f4 8f bf bf            (valid max — fine)
printf '%s' $'\U0000E000' | od -An -tx1
# both: ee 80 80               (valid PUA — fine)

Clean: \\u0041, short \\u41, \\x4/\\x41, \\0-\\0777, \\c?/\\cA, \\e, \\', trailing lone backslash, $'' — all identical to GNU. So the fallback path for failed unicode-decode emits the U+E000 sentinel into user-visible bytes instead of GNU's encode-as-is behavior. Same marker-leak family as #1060 (closed) and #1208 (open, mapfile -u), different trigger — filing separately per the closed-fixed + still-reproducing-on-new-path rule.

Env: niubash 1.4.4 / rubash engine 1b14a3d, GNU bash 5.3.20 aarch64-linux-android as oracle.

Activity

  1. added
    bug
    gnu-baseline
    P2-medium
    area:expansion
    on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P2-mediumarea:expansionbuggnu-baseline

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions