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

Index out of range in generated code #720

Open
keks opened this issue Jan 21, 2021 · 0 comments
Open

Index out of range in generated code #720

keks opened this issue Jan 21, 2021 · 0 comments

Comments

@keks
Copy link

keks commented Jan 21, 2021

I ran into a panic in generated code, specifically version 0.2.0 of go-graphsync. The code uses gogo version 1.3.1, but I checked the diff to 1.3.2 and it doesn't look like the issue has been fixed.

When calling message.FromNet with a reader that returns the following bytes/string, the generated code panics with the attached stack trace. The affected code does not use gogo anymore, but other users of gogo may experience similar issues.

Input: $\x1a \x8000\x1a\x16002\xf4\xff\xff\xff\xff\xff\xff\xff\xff00000000000000000

Stack Trace:

panic: runtime error: index out of range [-9223372036854775802]
goroutine 6 [running]:
runtime/debug.Stack(0xc00008f5e0, 0x8824e0, 0xc000028bc0)
        /usr/local/go/src/runtime/debug/stack.go:24 +0x9f
github.com/leastauthority/fleece/fuzzing.(*Crasher).Recover(0xc0000a4b80, 0xc00018fd80)
        /home/user/Projects/fleece/fuzzing/crasher.go:23 +0x57
panic(0x8824e0, 0xc000028bc0)    
        /usr/local/go/src/runtime/panic.go:969 +0x175       
github.com/ipfs/go-graphsync/message/pb.(*Message_Response).Unmarshal(0xc000093470, 0xc0001da1b2, 0x20, 0x22, 0x1, 0xc000093470)       
        /home/user/go/pkg/mod/github.com/ipfs/[email protected]/message/pb/message.pb.go:1343 +0x1025
github.com/ipfs/go-graphsync/message/pb.(*Message).Unmarshal(0xc0000b0460, 0xc0001da1b0, 0x24, 0x24, 0x7ff5c
4e00f01, 0x7ff5c45d5c58)   
        /home/user/go/pkg/mod/github.com/ipfs/[email protected]/message/pb/message.pb.go:843 +0x773
github.com/ipfs/go-graphsync/message/pb.(*Message).XXX_Unmarshal(0xc0000b0460, 0xc0001da1b0, 0x24, 0x24, 0xc
0000b0460, 0x1)            
        /home/user/go/pkg/mod/github.com/ipfs/[email protected]/message/pb/message.pb.go:42 +0x49
github.com/gogo/protobuf/proto.Unmarshal(0xc0001da1b0, 0x24, 0x24, 0xa58360, 0xc0000b0460, 0x24, 0x24)      
        /home/user/go/pkg/mod/github.com/gogo/[email protected]/proto/decode.go:337 +0x1aa
github.com/gogo/protobuf/io.(*varintReader).ReadMsg(0xc0000a4bc0, 0xa58360, 0xc0000b0460, 0x7fb18d, 0x0)    
        /home/user/go/pkg/mod/github.com/gogo/[email protected]/io/varint.go:125 +0x147
github.com/ipfs/go-graphsync/message.FromPBReader(0x7ff5c45d5c38, 0xc0000a4bc0, 0xc0000a4bc0, 0x7ff5c45d5c38
, 0xc0000a4bc0, 0xc0000bbc20)                         
        /home/user/go/pkg/mod/github.com/ipfs/[email protected]/message/message.go:270 +0x74
github.com/ipfs/go-graphsync/message.FromNet(0xa514a0, 0xc0000bbc20, 0xc00008fbf8, 0x5099ff, 0xc000001b00, 0
x7ff5c45d5bf8)             
        /home/user/go/pkg/mod/github.com/ipfs/[email protected]/message/message.go:264 +0x85
github.com/ipfs/go-graphsync/message.FuzzFromNetToNet(0xc0000e4240, 0x25, 0x225, 0x0)
        /home/user/go/pkg/mod/github.com/ipfs/[email protected]/message/message_fuzz.go:16 +0x75
github.com/leastauthority/fleece/fuzzing.(*Crasher).Test(0xc0000a4b80, 0xc00008fd80)
        /home/user/Projects/fleece/fuzzing/crasher.go:31 +0x7b
github.com/leastauthority/fleece/fuzzing.CrasherIterator.TestFailingLimit(0xc0000933c0, 0x1, 0x0, 0xc0000100
80, 0x1, 0x1, 0xc0001a7200, 0x8d, 0x8d, 0x9f1b78, ...)
        /home/user/Projects/fleece/fuzzing/iterator.go:109 +0xf0
github.com/ipfs/go-graphsync/message.TestFuzzFromNetToNet(0xc000001b00)
        /home/user/go/pkg/mod/github.com/ipfs/[email protected]/message/message_fuzz_test.go:38 +0x151
testing.tRunner(0xc000001b00, 0x9f1ba0)
        /usr/local/go/src/testing/testing.go:1108 +0xef
created by testing.(*T).Run 
        /usr/local/go/src/testing/testing.go:1159 +0x386
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant