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: accepts XML with no space between attributes #68385

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

encoding/xml: accepts XML with no space between attributes #68385

DemiMarie opened this issue Jul 11, 2024 · 2 comments · May be fixed by #69199
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 is on `pkg.go.dev` as of the filing of this issue

What did you do?

https://go.dev/play/p/_xXpPKU-YWQ

package main

import "encoding/xml"

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

What did you see happen?

Unmarshaling the XML succeeds, even though there is a missing space between b="c" and c="d".

What did you expect to see?

Unmarshaling <a b="c"c="d"/> fails. libxml2 correctly rejects this.

@DemiMarie DemiMarie changed the title import/path: issue title encoding/xml: accepts XML with no space between attribute value and name of next attribute Jul 11, 2024
@DemiMarie DemiMarie changed the title encoding/xml: accepts XML with no space between attribute value and name of next attribute encoding/xml: accepts XML with no space between attributes Jul 11, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/609378 mentions this issue: encoding/xml: Require whitespace between attributes

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