golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.04k stars 17.54k forks source link

encoding/xml: does not reject colons in processing instruction targets #68393

Open DemiMarie opened 2 months ago

DemiMarie commented 2 months ago

Go version

1.22

Output of go env in your module/workspace:

What is on https://go.dev/play as of when this issue is filed

What did you do?

Ran this Go code:

package main

import (
    "encoding/xml"
    "fmt"
)

func main() {
    err := xml.Unmarshal([]byte(`<?a:b?><a/>`), new(interface{}))
    if err != nil {
        fmt.Printf("XML correctly rejected with error %#v", err)
    } else {
        fmt.Println("No error?")
    }
}

What did you see happen?

No error? output, indicating that unmarshalling was successful.

What did you expect to see?

An error because processing instruction targets cannot contain colons in a namespace-well-formed document.

gabyhelp commented 2 months ago

Related Issues and Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

gopherbot commented 3 weeks ago

Change https://go.dev/cl/609377 mentions this issue: encoding/xml: treat a namespaced name as two names, not one