Skip to content

Commit

Permalink
Merge pull request #523 from Shopify/fuzz-fixes
Browse files Browse the repository at this point in the history
Fix two decoding bugs found by go-fuzz
  • Loading branch information
eapache committed Aug 26, 2015
2 parents 9dd45b2 + 306db49 commit 3a50f2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,10 @@ func (b *Broker) decode(pd packetDecoder) (err error) {
return err
}

b.addr = fmt.Sprint(host, ":", port)
b.addr = net.JoinHostPort(host, fmt.Sprint(port))
if _, _, err := net.SplitHostPort(b.addr); err != nil {
return err
}

return nil
}
Expand Down
3 changes: 3 additions & 0 deletions fetch_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ func (pr *FetchResponseBlock) decode(pd packetDecoder) (err error) {
if err != nil {
return err
}
if msgSetSize < 0 {
return PacketDecodingError{"invalid message set size"}
}

msgSetDecoder, err := pd.getSubset(int(msgSetSize))
if err != nil {
Expand Down

0 comments on commit 3a50f2c

Please sign in to comment.