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

mime: Parse/Format corrupt parameters #11290

Closed
dvyukov opened this issue Jun 19, 2015 · 1 comment
Closed

mime: Parse/Format corrupt parameters #11290

dvyukov opened this issue Jun 19, 2015 · 1 comment
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented Jun 19, 2015

The following program fails with the panic:

package main

import (
    "mime"
    "fmt"
)

func main() {
    sdata := "0/0;0*=0"
    mt, params, err := mime.ParseMediaType(sdata)
    if err != nil {
        return
    }
    sdata1 := mime.FormatMediaType(mt, params)
    _, _, err = mime.ParseMediaType(sdata1)
    if err != nil {
        fmt.Printf("%q(%q, %+v) -> %q\n", sdata, mt, params, sdata1)
        panic(err)
    }
}
"0/0;0*=0"("0/0", map[0:]) -> "0/0; 0=\"\""
panic: mime: invalid media parameter

Either Format/Parse must preserve parameters, or if that's incorrect input the first Parse must fail.

go version devel +514014c Thu Jun 18 15:54:35 2015 +0200 linux/amd64

@gopherbot
Copy link

CL https://golang.org/cl/17453 mentions this issue.

@rsc rsc closed this as completed in 025e9b0 Dec 5, 2015
@golang golang locked and limited conversation to collaborators Dec 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants