-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed as not planned
Closed as not planned
Copy link
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
During fuzzing some custom HTTP request handling of my own I discovered a Content-Type #;*0="" which mime.ParseMediaType is happy to parse more or less as I would expect without error, but for which mime.FormatMediaType returns an empty string indicating some part of it is invalid.
I'm not familiar enough with the details of the relevant standards to say which of the two is correct - I seriously doubt anyone needs it to be valid - but these two functions should probably agree on whether it's valid or not.
It seems possibly related to, but the impact is distinct from, #43128.
What version of Go are you using (go version)?
$ go version go version go1.19.3 linux/amd64
But also reproducible on go.dev.
What did you do?
https://go.dev/play/p/oeqtYtq72MY
t, param, err := mime.ParseMediaType(`#;*0=""`)
fmt.Printf("%q, %+v, %+v\n", t, param, err)
fmt.Printf("%q", mime.FormatMediaType(t, param))What did you expect to see?
An error during parsing, or some non-empty equivalent media type when reformatted:
"#", map[:], <nil>
"#;*0=\"\""
What did you see instead?
"#", map[:], <nil>
""
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.