diff --git a/lib/go/thrift/simple_json_protocol.go b/lib/go/thrift/simple_json_protocol.go
index <HASH>..<HASH> 100644
--- a/lib/go/thrift/simple_json_protocol.go
+++ b/lib/go/thrift/simple_json_protocol.go
@@ -909,6 +909,12 @@ func (p *TSimpleJSONProtocol) ParseBase64EncodedBody() ([]byte, error) {
 	}
 	line2 := line[0 : len(line)-1]
 	l := len(line2)
+	if (l % 4) != 0 {
+		pad := 4 - ( l % 4)
+		fill := [...]byte { '=', '=', '='}
+		line2 = append( line2, fill[:pad]...)
+		l = len(line2)
+	}
 	output := make([]byte, base64.StdEncoding.DecodedLen(l))
 	n, err := base64.StdEncoding.Decode(output, line2)
 	return output[0:n], NewTProtocolException(err)
THRIFT-<I> binary data may cause a failure with JSON transport under specific circumstances
Client: Go
Patch: Jens Geyer