hypebeast / go-osc

Open Sound Control (OSC) library for Golang. Implemented in pure Go.
MIT License
202 stars 46 forks source link

Fix panic if blobLen is less than 0 + other errors #49

Closed chabad360 closed 3 years ago

chabad360 commented 3 years ago

I've been fuzzing this library (with go-fuzz) to catch some inevitable errors, just came across one.

Fixes a panic in readBlob when blobLen is less than 0. The panic can be triggered with an invalid packet that contains an OSC-blob with a less than zero value. However I determined that logically a length of zero is also invalid, so I've set the check to require a minimum of 1.

Additionally, I'm checking to make sure that blobLen is actually fits within the read packet.

hypebeast commented 3 years ago

Thanks for the fix :)