summaryrefslogtreecommitdiff
path: root/lib/go/thrift
diff options
context:
space:
mode:
authorPhilippe Antoine <contact@catenacyber.fr>2021-03-15 09:26:39 +0100
committerYuxuan 'fishy' Wang <fishywang@gmail.com>2021-03-15 09:28:27 -0700
commit62beb6751d3c70f8db8fed4a3bb76e4ff3765c22 (patch)
tree311e1de5451218414a510bfabe5056eed1e45151 /lib/go/thrift
parentcc70b4e89a1579559bc50fb8216c471a5c550926 (diff)
downloadthrift-62beb6751d3c70f8db8fed4a3bb76e4ff3765c22.tar.gz
Early error check in golang struct reading
avoids a timeout on malformed input found by fuzzing
Diffstat (limited to 'lib/go/thrift')
-rw-r--r--lib/go/thrift/protocol.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/go/thrift/protocol.go b/lib/go/thrift/protocol.go
index 0a69bd416..4768c8f14 100644
--- a/lib/go/thrift/protocol.go
+++ b/lib/go/thrift/protocol.go
@@ -122,11 +122,14 @@ func Skip(ctx context.Context, self TProtocol, fieldType TType, maxDepth int) (e
return err
}
for {
- _, typeId, _, _ := self.ReadFieldBegin(ctx)
+ _, typeId, _, err := self.ReadFieldBegin(ctx)
+ if err != nil {
+ return err
+ }
if typeId == STOP {
break
}
- err := Skip(ctx, self, typeId, maxDepth-1)
+ err = Skip(ctx, self, typeId, maxDepth-1)
if err != nil {
return err
}