aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf/CodedInputStream.cs
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/src/Google.Protobuf/CodedInputStream.cs')
-rw-r--r--csharp/src/Google.Protobuf/CodedInputStream.cs17
1 files changed, 12 insertions, 5 deletions
diff --git a/csharp/src/Google.Protobuf/CodedInputStream.cs b/csharp/src/Google.Protobuf/CodedInputStream.cs
index abd352b9..0a829545 100644
--- a/csharp/src/Google.Protobuf/CodedInputStream.cs
+++ b/csharp/src/Google.Protobuf/CodedInputStream.cs
@@ -94,7 +94,7 @@ namespace Google.Protobuf
private bool hasNextTag = false;
internal const int DefaultRecursionLimit = 64;
- internal const int DefaultSizeLimit = 64 << 20; // 64MB
+ internal const int DefaultSizeLimit = Int32.MaxValue;
internal const int BufferSize = 4096;
/// <summary>
@@ -248,7 +248,7 @@ namespace Google.Protobuf
/// <remarks>
/// This limit is applied when reading from the underlying stream, as a sanity check. It is
/// not applied when reading from a byte array data source without an underlying stream.
- /// The default value is 64MB.
+ /// The default value is Int32.MaxValue.
/// </remarks>
/// <value>
/// The size limit.
@@ -268,6 +268,11 @@ namespace Google.Protobuf
public int RecursionLimit { get { return recursionLimit; } }
/// <summary>
+ /// Internal-only property; when set to true, unknown fields will be discarded while parsing.
+ /// </summary>
+ internal bool DiscardUnknownFields { get; set; }
+
+ /// <summary>
/// Disposes of this instance, potentially closing any underlying stream.
/// </summary>
/// <remarks>
@@ -424,7 +429,10 @@ namespace Google.Protobuf
}
}
- private void SkipGroup(uint startGroupTag)
+ /// <summary>
+ /// Skip a group.
+ /// </summary>
+ internal void SkipGroup(uint startGroupTag)
{
// Note: Currently we expect this to be the way that groups are read. We could put the recursion
// depth changes into the ReadTag method instead, potentially...
@@ -1050,7 +1058,7 @@ namespace Google.Protobuf
RecomputeBufferSizeAfterLimit();
int totalBytesRead =
totalBytesRetired + bufferSize + bufferSizeAfterLimit;
- if (totalBytesRead > sizeLimit || totalBytesRead < 0)
+ if (totalBytesRead < 0 || totalBytesRead > sizeLimit)
{
throw InvalidProtocolBufferException.SizeLimitExceeded();
}
@@ -1270,7 +1278,6 @@ namespace Google.Protobuf
}
}
}
-
#endregion
}
} \ No newline at end of file