Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
6e16037c
Commit
6e16037c
authored
Aug 08, 2015
by
Jon Skeet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address review comments.
parent
5bdc5729
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
GeneratedMessageTest.cs
csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
+22
-0
CodedInputStream.cs
csharp/src/Google.Protobuf/CodedInputStream.cs
+2
-2
No files found.
csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs
View file @
6e16037c
...
...
@@ -629,5 +629,27 @@ namespace Google.Protobuf
var
data
=
new
byte
[]
{
130
,
3
,
1
};
Assert
.
Throws
<
InvalidProtocolBufferException
>(()
=>
TestAllTypes
.
Parser
.
ParseFrom
(
data
));
}
/// <summary>
/// Demonstrates current behaviour with an extraneous end group tag - see issue 688
/// for details; we may want to change this.
/// </summary>
[
Test
]
public
void
ExtraEndGroupSkipped
()
{
var
message
=
SampleMessages
.
CreateFullTestAllTypes
();
var
stream
=
new
MemoryStream
();
var
output
=
new
CodedOutputStream
(
stream
);
output
.
WriteTag
(
100
,
WireFormat
.
WireType
.
EndGroup
);
output
.
WriteTag
(
TestAllTypes
.
SingleFixed32FieldNumber
,
WireFormat
.
WireType
.
Fixed32
);
output
.
WriteFixed32
(
123
);
output
.
Flush
();
stream
.
Position
=
0
;
var
parsed
=
TestAllTypes
.
Parser
.
ParseFrom
(
stream
);
Assert
.
AreEqual
(
new
TestAllTypes
{
SingleFixed32
=
123
},
parsed
);
}
}
}
csharp/src/Google.Protobuf/CodedInputStream.cs
View file @
6e16037c
...
...
@@ -346,7 +346,7 @@ namespace Google.Protobuf
switch
(
WireFormat
.
GetTagWireType
(
lastTag
))
{
case
WireFormat
.
WireType
.
StartGroup
:
Consume
Group
();
Skip
Group
();
break
;
case
WireFormat
.
WireType
.
EndGroup
:
// Just ignore; there's no data following the tag.
...
...
@@ -367,7 +367,7 @@ namespace Google.Protobuf
}
}
private
void
Consume
Group
()
private
void
Skip
Group
()
{
// 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...
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment