Repository: thrift Updated Branches: refs/heads/master bb272dbcd -> 9b9366145
THRIFT-3379 Potential out of range panic in Go JSON protocols Client: Go Patch: Nobuaki Sukegawa <[email protected]> This closes #646 Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/9b936614 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/9b936614 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/9b936614 Branch: refs/heads/master Commit: 9b9366145cd832c2219ffe884b01f9a7c9980b36 Parents: bb272db Author: Nobuaki Sukegawa <[email protected]> Authored: Sat Oct 10 11:28:54 2015 +0900 Committer: Jens Geyer <[email protected]> Committed: Wed Oct 14 00:34:05 2015 +0200 ---------------------------------------------------------------------- lib/go/thrift/json_protocol.go | 4 ++-- lib/go/thrift/simple_json_protocol.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/9b936614/lib/go/thrift/json_protocol.go ---------------------------------------------------------------------- diff --git a/lib/go/thrift/json_protocol.go b/lib/go/thrift/json_protocol.go index 669a7bd..ec549b7 100644 --- a/lib/go/thrift/json_protocol.go +++ b/lib/go/thrift/json_protocol.go @@ -387,7 +387,7 @@ func (p *TJSONProtocol) ReadString() (string, error) { if err != nil { return v, err } - } else if len(f) >= 0 && f[0] == JSON_NULL[0] { + } else if len(f) > 0 && f[0] == JSON_NULL[0] { b := make([]byte, len(JSON_NULL)) _, err := p.reader.Read(b) if err != nil { @@ -417,7 +417,7 @@ func (p *TJSONProtocol) ReadBinary() ([]byte, error) { if err != nil { return v, err } - } else if len(f) >= 0 && f[0] == JSON_NULL[0] { + } else if len(f) > 0 && f[0] == JSON_NULL[0] { b := make([]byte, len(JSON_NULL)) _, err := p.reader.Read(b) if err != nil { http://git-wip-us.apache.org/repos/asf/thrift/blob/9b936614/lib/go/thrift/simple_json_protocol.go ---------------------------------------------------------------------- diff --git a/lib/go/thrift/simple_json_protocol.go b/lib/go/thrift/simple_json_protocol.go index d30e2bc..e739be9 100644 --- a/lib/go/thrift/simple_json_protocol.go +++ b/lib/go/thrift/simple_json_protocol.go @@ -501,7 +501,7 @@ func (p *TSimpleJSONProtocol) ReadString() (string, error) { if err != nil { return v, err } - } else if len(f) >= 0 && f[0] == JSON_NULL[0] { + } else if len(f) > 0 && f[0] == JSON_NULL[0] { b := make([]byte, len(JSON_NULL)) _, err := p.reader.Read(b) if err != nil { @@ -531,7 +531,7 @@ func (p *TSimpleJSONProtocol) ReadBinary() ([]byte, error) { if err != nil { return v, err } - } else if len(f) >= 0 && f[0] == JSON_NULL[0] { + } else if len(f) > 0 && f[0] == JSON_NULL[0] { b := make([]byte, len(JSON_NULL)) _, err := p.reader.Read(b) if err != nil {
