add size check to bundle content

This commit is contained in:
Joel Wetzell
2026-05-20 17:41:37 -05:00
parent f7850ce70e
commit 8b8129b2e2
+4
View File
@@ -66,6 +66,10 @@ func BundleFromBytes(bytes []byte) (*OSCBundle, []byte, error) {
remainingBytes = bytesAfterContentSize remainingBytes = bytesAfterContentSize
if contentSize <= 0 {
return nil, remainingBytes, errors.New("bundle content size must be positive")
}
if len(remainingBytes) < int(contentSize) { if len(remainingBytes) < int(contentSize) {
return nil, remainingBytes, errors.New("bundle doesn't have enough bytes for the content size it specifies") return nil, remainingBytes, errors.New("bundle doesn't have enough bytes for the content size it specifies")
} }