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

[fuzzing] dagcbor Decode/Encode panic: index out of range #7

Open
bryanchriswhite opened this issue Oct 13, 2020 · 3 comments
Open

Comments

@bryanchriswhite
Copy link
Contributor

Crasher

095da066af3e1b98946007a7e76901af4836f2cf

Quoted Input

        "\x8d\x8d\x97\xd8*@"

Output

panic: runtime error: index out of range [0] with length 0                                                  
goroutine 6 [running]:                                                                                      
runtime/debug.Stack(0xc000085660, 0x713920, 0xc00001ab20)                                                   
        /usr/local/go/src/runtime/debug/stack.go:24 +0x9f                                                   
github.com/leastauthority/fleece/fuzzing.(*Crasher).Recover(0xc00007f040, 0xc000195d70)                     
        /home/bwhite/go/pkg/mod/github.com/leastauthority/fleece@v0.0.1-alpha/fuzzing/crasher.go:23 +0x57   
panic(0x713920, 0xc00001ab20)                                                                               
        /usr/local/go/src/runtime/panic.go:969 +0x175                                                       
github.com/ipld/go-ipld-prime/codec/dagcbor.unmarshal(0x78fc00, 0xc00000ed48, 0x789960, 0xc0000a2500, 0xc000
1b6700, 0x0, 0xc0001b6700)                                                                                  
        /run/media/bwhite/1TB SSD/go-ipld-prime/codec/dagcbor/unmarshal.go:130 +0xb88                       
github.com/ipld/go-ipld-prime/codec/dagcbor.unmarshal(0x78fc00, 0xc00000ed08, 0x789960, 0xc0000a2500, 0xc000
1b6700, 0x0, 0xc0001b6700)                                                                                  
        /run/media/bwhite/1TB SSD/go-ipld-prime/codec/dagcbor/unmarshal.go:112 +0x1a8                       
github.com/ipld/go-ipld-prime/codec/dagcbor.unmarshal(0x78fc00, 0xc0000a24e0, 0x789960, 0xc0000a2500, 0xc000
1b6700, 0x0, 0xc0001b6700)                                                                                  
        /run/media/bwhite/1TB SSD/go-ipld-prime/codec/dagcbor/unmarshal.go:112 +0x1a8
github.com/ipld/go-ipld-prime/codec/dagcbor.unmarshal(0x7f064c709e18, 0xc0000a24b0, 0x789960, 0xc0000a2500, 
0xc0001b6700, 0x710740, 0x972c01)
        /run/media/bwhite/1TB SSD/go-ipld-prime/codec/dagcbor/unmarshal.go:112 +0x1a8
github.com/ipld/go-ipld-prime/codec/dagcbor.Unmarshal(0x7f064c709e18, 0xc0000a24b0, 0x789960, 0xc0000a2500, 
0x0, 0x40cf00)
        /run/media/bwhite/1TB SSD/go-ipld-prime/codec/dagcbor/unmarshal.go:33 +0xcc
github.com/ipld/go-ipld-prime/codec/dagcbor.Decoder(0x7f064c709e18, 0xc0000a24b0, 0x7897a0, 0xc0000ad7d0, 0x
c0000a24b0, 0x0)
        /run/media/bwhite/1TB SSD/go-ipld-prime/codec/dagcbor/multicodec.go:32 +0x1d2
github.com/ipld/go-ipld-prime/codec/dagcbor.FuzzCBORDecodeEncode(0xc0003386c0, 0x6, 0x206, 0x0)
        /run/media/bwhite/1TB SSD/go-ipld-prime/codec/dagcbor/multicodec_fuzz.go:16 +0xe8
github.com/leastauthority/fleece/fuzzing.(*Crasher).Test(0xc00007f040, 0xc000085d70)
        /home/bwhite/go/pkg/mod/github.com/leastauthority/fleece@v0.0.1-alpha/fuzzing/crasher.go:31 +0x7b
github.com/leastauthority/fleece/fuzzing.CrasherIterator.TestFailingLimit(0xc00007d150, 0x34, 0x11, 0xc00000
e800, 0x3, 0x4, 0xc000224000, 0x54c, 0x54c, 0x7468b0, ...)
        /home/bwhite/go/pkg/mod/github.com/leastauthority/fleece@v0.0.1-alpha/fuzzing/iterator.go:109 +0xf0
github.com/ipld/go-ipld-prime/codec/dagcbor.TestFuzzCBORDecodeEncode(0xc000001b00)
        /run/media/bwhite/1TB SSD/go-ipld-prime/codec/dagcbor/multicodec_fuzz_test.go:57 +0x171
testing.tRunner(0xc000001b00, 0x7468b8)
        /usr/local/go/src/testing/testing.go:1108 +0xef
created by testing.(*T).Run 
        /usr/local/go/src/testing/testing.go:1159 +0x386
warpfork added a commit to ipld/go-ipld-prime that referenced this issue Oct 21, 2020
@warpfork
Copy link
Collaborator

Put a tasty new fix for this on master just now, thanks for uncovering this :)

@schomatis
Copy link

@bryanchriswhite
Copy link
Contributor Author

Put a tasty new fix for this on master just now, thanks for uncovering this :)

Nice and of course! 😄

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

3 participants