Skip to content

Escape disallowed C0 controls in forced scalar styles - #1508

Closed
himanshu748 wants to merge 1 commit into
jbeder:masterfrom
himanshu748:fix/1506-c0-scalar-controls
Closed

himanshu748 wants to merge 1 commit into
jbeder:masterfrom
himanshu748:fix/1506-c0-scalar-controls

Conversation

@himanshu748

Copy link
Copy Markdown

Fixes #1506.

Forced SingleQuoted and Literal styles currently accept disallowed C0 control bytes and emit them raw. Reject those bytes during style selection so the existing double-quoted writer escapes them. TAB stays valid in both styles, LF stays valid in Literal, and the existing CR and flow-context fallbacks are preserved. The unsigned-byte comparison keeps UTF-8 bytes from being mistaken for C0 controls.

Five tests cover all 29 disallowed C0 values in both styles, exact escaping and length-aware round trips, permitted whitespace and Unicode, EscapeNonAscii, and Literal in a flow sequence. The regressions fail against the original emitter implementation and pass with this change.

Validation on Linux with GCC 14.2:

  • All 1,073 enabled tests pass, including 154 emitter tests; 8 existing disabled tests remain unchanged.
  • All 3 CTest targets pass in Debug/static, Release/shared with a C++11 configuration, and ASan/UBSan builds.
  • PyYAML rejects all 58 original raw-control outputs and round-trips all 58 fixed outputs.
  • Changed-range clang-format, repository whitespace checks, and git diff --check pass.

DEL/C1 and broader Unicode printability are outside this change. Leak detection was disabled because LeakSanitizer cannot run under this container's ptrace restriction. Windows, macOS, and Bazel were not run locally.

@himanshu748
himanshu748 marked this pull request as ready for review October 8, 2026 12:58
@jbeder

jbeder commented Oct 8, 2026

Copy link
Copy Markdown
Owner

👀🤖

@SGSSGene SGSSGene added the AI label Oct 8, 2026
@SGSSGene

SGSSGene commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

@jbeder : I would like to reject this type of PR. Its a first time contributer which clearly just handed in some AI generated output. The PR text has no polishing and way to much information and I (and believe the same is valid for you) dont have the time to review this.
Just reading and checking this takes more time than fixing it myself Which I dont have the time for ;)

@jbeder

jbeder commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Totally reasonable!

Copy link
Copy Markdown
Author

Thanks for the feedback. I asked my cloud agent to work on the ByteAsk challenge, and it prepared and opened this PR with my approval. I’m withdrawing it. If you’re open to a revised version, I’m happy to address the concerns and make it easier to review.

@himanshu748 himanshu748 closed this Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Forced single-quoted or literal style emits raw NUL and U+0001

3 participants