Rhymen / go-whatsapp

WhatsApp Web API
MIT License
2.07k stars 493 forks source link

panic in binary.Unmarshal #603

Open tie opened 3 years ago

tie commented 3 years ago

What did you do?

Wrote a simple fuzz target using https://blog.golang.org/fuzz-beta. Immediately found first crasher.

binary.Unmarshal([]byte("\x00\xff\x80"))

https://play.golang.org/p/41B5GBalYFb

What did you expect to see?

An error.

What did you see instead?

panic: runtime error: slice bounds out of range [:-1]

Does this issue reproduce with the latest release?

Yes, I can reproduce the issue after upgrading to the latest commit.

go get github.com/Rhymen/go-whatsapp/binary@v0.1.2-0.20210714125832-447ed9cc6179