Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new line on encoding folded style #960

Open
wants to merge 1 commit into
base: v3
Choose a base branch
from

Conversation

zecke
Copy link

@zecke zecke commented May 3, 2023

When using:

 >-
   someline
     more

The encoder would emit:

 >-
   someline

     more

The issue was introduced in the original translation from C to Go. In the C code the MOVE macro would advance the start pointer of the string. In the Go case "k = 0" points to the start of the string where in the C case it would be the read pointer. Fix it.

Also address bound checks to not go beyond the string (I assume in the C code there is an explicit NUL or at least some NUL).

Fixes: #804

When using:

 >-
   someline
     more

The encoder would emit:

 >-
   someline

     more

The issue was introduced in the original translation from C to
Go. In the C code the MOVE macro would advance the start pointer
of the string. In the Go case "k = 0" points to the start of the
string where in the C case it would be the read pointer. Fix it.

Also address bound checks to not go beyond the string (I assume in
the C code there is an explicit NUL or at least some NUL).

Fixes: go-yaml#804
@zecke
Copy link
Author

zecke commented May 14, 2023

@niemeyer Any chance you can have a look?

@dolmen
Copy link

dolmen commented Mar 12, 2024

@zecke In #1028 I'm proposing to add a fuzzer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v3: FoldedStyle yaml.Node results in unexpected newlines
3 participants