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

Piped ipfs add --hash id kills the daemon #4367

Closed
lidel opened this issue Nov 5, 2017 · 4 comments
Closed

Piped ipfs add --hash id kills the daemon #4367

lidel opened this issue Nov 5, 2017 · 4 comments
Labels
kind/bug A bug in existing code (including security flaws) panic

Comments

@lidel
Copy link
Member

lidel commented Nov 5, 2017

Version information:

go-ipfs version: 0.4.12-rc1-5146b34
Repo version: 6
System version: amd64/linux
Golang version: go1.9.1

Type:

Bug

Severity:

Medium (potential vector for denial of service attack)

Description:

Adding piped content with --hash id kills the daemon:

 cat anyfile | ipfs add --hash id

go-ipfs output before shutting down:

panic: runtime error: slice bounds out of range

goroutine 16238 [running]:
gx/ipfs/QmU9a9NV9RdPNwZQDYd5uKsm6N6LJLSvLbywDDYFbaaC6P/go-multihash.Sum(0xc421864110, 0x4, 0x4, 0x0, 0x20, 0x4, 0x4, 0x0, 0x0, 0x1356c80)
	/go/src/gx/ipfs/QmU9a9NV9RdPNwZQDYd5uKsm6N6LJLSvLbywDDYFbaaC6P/go-multihash/sum.go:105 +0xd88
gx/ipfs/QmNp85zy9RLrQ5oQD4hPyS39ezrrXpcaa7R4Y9kxdWQLLQ/go-cid.Prefix.Sum(0x1, 0x70, 0x0, 0xffffffffffffffff, 0xc421864110, 0x4, 0x4, 0xc422043aa8, 0xc420031f08, 0x1)
	/go/src/gx/ipfs/QmNp85zy9RLrQ5oQD4hPyS39ezrrXpcaa7R4Y9kxdWQLLQ/go-cid/cid.go:434 +0x69
github.com/ipfs/go-ipfs/merkledag.(*ProtoNode).EncodeProtobuf(0xc420287960, 0xc420287900, 0xc4202879d0, 0x0, 0x0, 0x1c5b800, 0x1330fc0)
	/go/src/github.com/ipfs/go-ipfs/merkledag/coding.go:94 +0x1ed
github.com/ipfs/go-ipfs/merkledag.(*ProtoNode).RawData(0xc420287960, 0xc422043b78, 0xcb8b02, 0xc4206a5a00)
	/go/src/github.com/ipfs/go-ipfs/merkledag/node.go:206 +0x30
github.com/ipfs/go-ipfs/merkledag.(*ProtoNode).Cid(0xc420287960, 0x0)
	/go/src/github.com/ipfs/go-ipfs/merkledag/node.go:306 +0x9f
github.com/ipfs/go-ipfs/merkledag.(*ProtoNode).String(0xc420287960, 0x2, 0x8)
	/go/src/github.com/ipfs/go-ipfs/merkledag/node.go:318 +0x2b
github.com/ipfs/go-ipfs/mfs.NewRoot(0x1c50520, 0xc421012940, 0x1c55960, 0xc4214d0a70, 0xc420287960, 0x0, 0x36, 0xc421564cc0, 0x31)
	/go/src/github.com/ipfs/go-ipfs/mfs/system.go:92 +0x253
github.com/ipfs/go-ipfs/core/coreunix.(*Adder).mfsRoot(0xc4201535e0, 0xc421564cc0, 0x31, 0x1)
	/go/src/github.com/ipfs/go-ipfs/core/coreunix/add.go:121 +0xe4
github.com/ipfs/go-ipfs/core/coreunix.(*Adder).addNode(0xc4201535e0, 0x1c57720, 0xc4214d0ba0, 0xc421564cc0, 0x31, 0xc4201c09c0, 0x1c55960)
	/go/src/github.com/ipfs/go-ipfs/core/coreunix/add.go:394 +0x7d
github.com/ipfs/go-ipfs/core/coreunix.(*Adder).addFile(0xc4201535e0, 0x1c545e0, 0xc421926820, 0x0, 0x0)
	/go/src/github.com/ipfs/go-ipfs/core/coreunix/add.go:493 +0x480
github.com/ipfs/go-ipfs/core/coreunix.(*Adder).AddFile(0xc4201535e0, 0x1c545e0, 0xc421926820, 0x0, 0x0)
	/go/src/github.com/ipfs/go-ipfs/core/coreunix/add.go:431 +0x83
github.com/ipfs/go-ipfs/core/commands.glob..func6.1(0x1c54580, 0xc4218791d0, 0xc4218791d0, 0xc421864090)
	/go/src/github.com/ipfs/go-ipfs/core/commands/add.go:282 +0x83
github.com/ipfs/go-ipfs/core/commands.glob..func6.2(0xc421d96a20, 0xc421764d20, 0x1c595c0, 0xc420d206c0, 0x1c58900, 0xc420286770)
	/go/src/github.com/ipfs/go-ipfs/core/commands/add.go:302 +0x7c
created by github.com/ipfs/go-ipfs/core/commands.glob..func6
	/go/src/github.com/ipfs/go-ipfs/core/commands/add.go:300 +0xcce
@whyrusleeping
Copy link
Member

In irc you were wondering if this was a bug or not. This one definitely counts as a bug.

@whyrusleeping whyrusleeping added kind/bug A bug in existing code (including security flaws) panic labels Nov 5, 2017
@Stebalien
Copy link
Member

I believe this is already fixed in go-multihash (unreleased).

@kevina
Copy link
Contributor

kevina commented Nov 28, 2017

@Stebalien so this is fixed by multiformats/go-multihash#55?

@Stebalien
Copy link
Member

@kevina It should be.

@momack2 momack2 added this to Done in ipfs/go-ipfs May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) panic
Projects
No open projects
Development

No branches or pull requests

4 participants