summaryrefslogtreecommitdiff
path: root/tests/pb
diff options
context:
space:
mode:
authorJosh Haberman <jhaberman@gmail.com>2014-07-24 09:04:46 -0700
committerJosh Haberman <jhaberman@gmail.com>2014-07-24 09:04:46 -0700
commitd493500abc6def6b62d664990ed821e0a836a6cf (patch)
tree1ceb65e6866ee63612dd73363944a0fc99a65550 /tests/pb
parent47b5e0968aa0ec47f522ba357c159b2450645806 (diff)
Sync from Google-internal development.
Diffstat (limited to 'tests/pb')
-rw-r--r--tests/pb/test_decoder.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/pb/test_decoder.cc b/tests/pb/test_decoder.cc
index e016632..2d94d82 100644
--- a/tests/pb/test_decoder.cc
+++ b/tests/pb/test_decoder.cc
@@ -612,6 +612,9 @@ void run_decoder(const string& proto, const string* expected_output) {
if (ok) {
fprintf(stderr, "Didn't expect ok result, but got output: '%s'\n",
output.c_str());
+ } else if (filter_hash) {
+ fprintf(stderr, "Failed as we expected, with message: %s\n",
+ status.error_message());
}
ASSERT(!ok);
}
@@ -838,6 +841,10 @@ void test_invalid() {
// Field number is 0.
assert_does_not_parse(
cat( tag(0, UPB_WIRE_TYPE_DELIMITED), varint(0) ));
+ // The previous test alone did not catch this particular pattern which could
+ // corrupt the internal state.
+ assert_does_not_parse(
+ cat( tag(0, UPB_WIRE_TYPE_64BIT), uint64(0) ));
// Field number is too large.
assert_does_not_parse(
@@ -928,6 +935,12 @@ void test_valid() {
submsg(12345, string(" ")),
"<\n>\n");
+ // This triggered a previous bug in the decoder.
+ assert_successful_parse(
+ cat( tag(UPB_DESCRIPTOR_TYPE_SFIXED32, UPB_WIRE_TYPE_VARINT),
+ varint(0) ),
+ "<\n>\n");
+
assert_successful_parse(
cat(
submsg(UPB_DESCRIPTOR_TYPE_MESSAGE,
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback