From b8a2a83acfe6e6770b75de42d5ff4c67596675c0 Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Fri, 13 Jan 2017 11:21:00 -0800 Subject: [PATCH] otr: add missing return on error path Due to a missing return, corrupt TLV data would cause an infinite loop that consumes memory, eventually crashing the process. Thanks to Ivan Markin for pointing this out. Change-Id: Iaaf7c5f7ce911d3e542b86f6b942b15e2ccbdf3b Reviewed-on: https://go-review.googlesource.com/35247 Run-TryBot: Adam Langley TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- otr/otr.go | 1 + 1 file changed, 1 insertion(+) diff --git a/otr/otr.go b/otr/otr.go index 8861b77c71..173b753dbd 100644 --- a/otr/otr.go +++ b/otr/otr.go @@ -943,6 +943,7 @@ func (c *Conversation) processData(in []byte) (out []byte, tlvs []tlv, err error t.data, tlvData, ok3 = getNBytes(tlvData, int(t.length)) if !ok1 || !ok2 || !ok3 { err = errors.New("otr: corrupt tlv data") + return } tlvs = append(tlvs, t) }