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

encoding/xml: does not require whitespace before processing instruction value #68386

Open
Tracked by #68293
DemiMarie opened this issue Jul 11, 2024 · 2 comments · May be fixed by #69200
Open
Tracked by #68293

encoding/xml: does not require whitespace before processing instruction value #68386

DemiMarie opened this issue Jul 11, 2024 · 2 comments · May be fixed by #69200
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@DemiMarie
Copy link
Contributor

Go version

1.22.5 (this is from pkg.go.dev)

Output of go env in your module/workspace:

Whatever pkg.go.dev uses when this issue is filed

What did you do?

https://go.dev/play/p/rzV-FdleVIV

package main

import "encoding/xml"

func main() {
	err := xml.Unmarshal([]byte(`<?a /b?><a/>`), new(interface{}))
	if err != nil {
		panic("well-formed XML rejected")
	}
	err = xml.Unmarshal([]byte(`<?a/b?><a/>`), new(interface{}))
	if err == nil {
		panic("missing space before processing instruction value accepted")
	}
}

What did you see happen?

<?a/b?><a/> is parsed successfully.

What did you expect to see?

Error because <?a/b?> is not a well-formed processing instruction. There must be whitespace between the processing instruction target and value.

@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 13, 2024
DemiMarie added a commit to DemiMarie/go that referenced this issue Sep 1, 2024
The value of a processing instruction must either be empty or have
whitespace before it.

Fixes: golang#68386
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/609379 mentions this issue: encoding/xml: require whitespace before processing instruction value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants