THRIFT-5874 Introduce new type MESSAGE_SIZE_LIMIT in TTransportException
Client: Delphi
Patch: Jens Geyer
diff --git a/lib/netstd/Thrift/Protocol/TJSONProtocol.cs b/lib/netstd/Thrift/Protocol/TJSONProtocol.cs
index ae37a80..170f294 100644
--- a/lib/netstd/Thrift/Protocol/TJSONProtocol.cs
+++ b/lib/netstd/Thrift/Protocol/TJSONProtocol.cs
@@ -468,6 +468,7 @@
                     }
 
                     // it's \uXXXX
+                    Trans.CheckReadBytesAvailable(4);
                     await Trans.ReadAllAsync(_tempBuffer, 0, 4, cancellationToken);
 
                     var wch = (short) ((TJSONProtocolHelper.ToHexVal(_tempBuffer[0]) << 12) +
@@ -1018,6 +1019,7 @@
                 else
                 {
                     // find more easy way to avoid exception on reading primitive types
+                    Proto.Trans.CheckReadBytesAvailable(1);
                     await Proto.Trans.ReadAllAsync(_data, 0, 1, cancellationToken);
                 }
                 return _data[0];
@@ -1034,6 +1036,7 @@
                 if (!_hasData)
                 {
                     // find more easy way to avoid exception on reading primitive types
+                    Proto.Trans.CheckReadBytesAvailable(1);
                     await Proto.Trans.ReadAllAsync(_data, 0, 1, cancellationToken);
                     _hasData = true;
                 }