diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2017-10-24 10:49:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-24 10:49:50 -0400 |
commit | ee8a0911cbaca2a1849a847bbdc523120d003a31 (patch) | |
tree | 5003225ddf2fbf8f0ad98d33756e73bc16b82ff0 /objectivec/Tests/GPBMessageTests+Serialization.m | |
parent | b189389e2f2ca01dd534a8e9ba3ac38ea45cdba6 (diff) | |
parent | b1f954e639f7cfd2c8768df62347f1e97a85aa7c (diff) | |
download | protobuf-ee8a0911cbaca2a1849a847bbdc523120d003a31.tar.gz protobuf-ee8a0911cbaca2a1849a847bbdc523120d003a31.tar.bz2 protobuf-ee8a0911cbaca2a1849a847bbdc523120d003a31.zip |
Merge pull request #3787 from sergiocampama/coverage
Improves coverage of GPBCodedInputStream
Diffstat (limited to 'objectivec/Tests/GPBMessageTests+Serialization.m')
-rw-r--r-- | objectivec/Tests/GPBMessageTests+Serialization.m | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/objectivec/Tests/GPBMessageTests+Serialization.m b/objectivec/Tests/GPBMessageTests+Serialization.m index 4a4c5447..55d77a1f 100644 --- a/objectivec/Tests/GPBMessageTests+Serialization.m +++ b/objectivec/Tests/GPBMessageTests+Serialization.m @@ -42,10 +42,6 @@ #import "google/protobuf/UnittestRuntimeProto2.pbobjc.h" #import "google/protobuf/UnittestRuntimeProto3.pbobjc.h" -static NSData *DataFromCStr(const char *str) { - return [NSData dataWithBytes:str length:strlen(str)]; -} - @interface MessageSerializationTests : GPBTestCase @end @@ -980,6 +976,16 @@ static NSData *DataFromCStr(const char *str) { XCTAssertEqual(error.code, GPBCodedInputStreamErrorRecursionDepthExceeded); } +- (void)testParseDelimitedDataWithNegativeSize { + NSData *data = DataFromCStr("\xFF\xFF\xFF\xFF\x0F"); + GPBCodedInputStream *input = [GPBCodedInputStream streamWithData:data]; + NSError *error; + [GPBMessage parseDelimitedFromCodedInputStream:input + extensionRegistry:nil + error:&error]; + XCTAssertNil(error); +} + #ifdef DEBUG - (void)testErrorMissingRequiredField { NSData *data = DataFromCStr(""); |