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

x/net/icmp: MessageBody.Len returns an incorrect value #13141

Closed
mikioh opened this issue Nov 4, 2015 · 1 comment
Closed

x/net/icmp: MessageBody.Len returns an incorrect value #13141

mikioh opened this issue Nov 4, 2015 · 1 comment

Comments

@mikioh
Copy link
Contributor

mikioh commented Nov 4, 2015

For example, the following outputs "assert false 140", it should be "assert true 136."

import "golang.org/x/net/icmp"

func main() {
        body := &icmp.ParamProb{
                Data: make([]byte, 128),
                Extensions: []icmp.Extension{
                        &icmp.MPLSLabelStack{},
                },
        }
        println("assert", body.Len(1) == 136, body.Len(1))
}

Sigh, the roundup calc line in multipart.go should be

return (r + align - 1) & ^(align - 1)

instead of

return (r + align) &^ (align - 1)
@gopherbot
Copy link

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

@ianlancetaylor ianlancetaylor added this to the Unreleased milestone Nov 5, 2015
@golang golang locked and limited conversation to collaborators Nov 27, 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

3 participants