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

net/mail: fails to escape address #11294

Closed
dvyukov opened this issue Jun 19, 2015 · 10 comments
Closed

net/mail: fails to escape address #11294

dvyukov opened this issue Jun 19, 2015 · 10 comments
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented Jun 19, 2015

The following program fails with the panic:

package main

import (
    "fmt"
    "net/mail"
)

func main() {
    data := "=??Q? ?=<0@0>"
    addr, err := mail.ParseAddress(data)
    if err != nil {
        return
    }
    _, err = mail.ParseAddress(addr.String())
    if err != nil {
        fmt.Printf("failed to parse addr: %q -> %q\n", data, addr)
        panic(err)
    }
}
failed to parse addr: "=??Q? ?=<0@0>" -> "\"=??Q? ?=\" <0@0>"
panic: mail: missing word in phrase: charset not supported: ""

That name should have been escaped.

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

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jun 19, 2015
@rsc
Copy link
Contributor

rsc commented Nov 25, 2015

Dup of #11292.

@rsc rsc closed this as completed Nov 25, 2015
@alexcesaro
Copy link
Contributor

@rsc This issue is not a duplicate of #11292 and this code still panics on tip.

I will have a look during Go 1.7 dev cycle.

@bradfitz bradfitz reopened this Dec 2, 2015
@bradfitz
Copy link
Contributor

bradfitz commented Dec 2, 2015

@alexcesaro, any chance you have time to look at this for 1.6 still? It would be nice to not have panics in code parsing random inputs.

@alexcesaro
Copy link
Contributor

It is Dmitry's snippet above that panics not the net/mail code.

Also it is not a regression, that bug was discovered before Go 1.5 and is probably there since the beginning.

@bradfitz
Copy link
Contributor

bradfitz commented Dec 2, 2015

It is Dmitry's snippet above that panics not the net/mail code.

Sorry, I'm always confused by the reports saying "this code panics" when the code is just doing if err { panic }

@alexcesaro
Copy link
Contributor

Yes sorry I wasn't clear :)

@rsc
Copy link
Contributor

rsc commented Dec 3, 2015 via email

@rsc rsc unassigned dsymonds Dec 3, 2015
@alexcesaro
Copy link
Contributor

I am on my phone but I don't think it is the same bug.

#11292 was an encoding issue. Here it is a parsing issue: the code thinks there is an encoded-word but it is not.

@rsc
Copy link
Contributor

rsc commented Dec 3, 2015 via email

@gopherbot
Copy link

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

@rsc rsc closed this as completed in e8cc083 Dec 4, 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

7 participants