|
@@ -46,6 +46,7 @@ namespace Google.Protobuf
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Primitives for parsing protobuf wire format.
|
|
/// Primitives for parsing protobuf wire format.
|
|
/// </summary>
|
|
/// </summary>
|
|
|
|
+ [SecuritySafeCritical]
|
|
internal static class ParsingPrimitives
|
|
internal static class ParsingPrimitives
|
|
{
|
|
{
|
|
|
|
|
|
@@ -595,6 +596,7 @@ namespace Google.Protobuf
|
|
/// <exception cref="InvalidProtocolBufferException">
|
|
/// <exception cref="InvalidProtocolBufferException">
|
|
/// the end of the stream or the current limit was reached
|
|
/// the end of the stream or the current limit was reached
|
|
/// </exception>
|
|
/// </exception>
|
|
|
|
+ [SecuritySafeCritical]
|
|
public static string ReadRawString(ref ReadOnlySpan<byte> buffer, ref ParserInternalState state, int length)
|
|
public static string ReadRawString(ref ReadOnlySpan<byte> buffer, ref ParserInternalState state, int length)
|
|
{
|
|
{
|
|
// No need to read any data for an empty string.
|
|
// No need to read any data for an empty string.
|
|
@@ -643,7 +645,8 @@ namespace Google.Protobuf
|
|
// Slow path: Build a byte array first then copy it.
|
|
// Slow path: Build a byte array first then copy it.
|
|
return CodedOutputStream.Utf8Encoding.GetString(ReadRawBytes(ref buffer, ref state, length), 0, length);
|
|
return CodedOutputStream.Utf8Encoding.GetString(ReadRawBytes(ref buffer, ref state, length), 0, length);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ [SecuritySafeCritical]
|
|
private static byte ReadRawByte(ref ReadOnlySpan<byte> buffer, ref ParserInternalState state)
|
|
private static byte ReadRawByte(ref ReadOnlySpan<byte> buffer, ref ParserInternalState state)
|
|
{
|
|
{
|
|
if (state.bufferPos == state.bufferSize)
|
|
if (state.bufferPos == state.bufferSize)
|