diff options
author | Feng Xiao <xfxyjwf@gmail.com> | 2015-12-21 00:31:04 -0800 |
---|---|---|
committer | Feng Xiao <xfxyjwf@gmail.com> | 2015-12-21 00:34:19 -0800 |
commit | d21780841734326d8a7653710f4f23b5366c4447 (patch) | |
tree | 25df44708c81059a3e1c7025e12b734cc80ee3f4 /objectivec/Tests/GPBCodedInputStreamTests.m | |
parent | 1e2fece3e01b8e079b4f6930306377a9332a2ddb (diff) | |
parent | b27f2893b2a118b4e3bfcd23d32114dbdd4e6d9b (diff) | |
download | protobuf-d21780841734326d8a7653710f4f23b5366c4447.tar.gz protobuf-d21780841734326d8a7653710f4f23b5366c4447.tar.bz2 protobuf-d21780841734326d8a7653710f4f23b5366c4447.zip |
Merge branch master into v3.0.0-beta-2
Diffstat (limited to 'objectivec/Tests/GPBCodedInputStreamTests.m')
-rw-r--r-- | objectivec/Tests/GPBCodedInputStreamTests.m | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/objectivec/Tests/GPBCodedInputStreamTests.m b/objectivec/Tests/GPBCodedInputStreamTests.m index 7c3c006b..b0e39d2c 100644 --- a/objectivec/Tests/GPBCodedInputStreamTests.m +++ b/objectivec/Tests/GPBCodedInputStreamTests.m @@ -266,6 +266,9 @@ } // Verifies fix for b/10315336. +// Note: Now that there isn't a custom string class under the hood, this test +// isn't as critical, but it does cover bad input and if a custom class is added +// again, it will help validate that class' handing of bad utf8. - (void)testReadMalformedString { NSOutputStream* rawOutput = [NSOutputStream outputStreamToMemory]; GPBCodedOutputStream* output = @@ -276,7 +279,7 @@ [output writeRawVarint32:tag]; [output writeRawVarint32:5]; // Create an invalid utf-8 byte array. - uint8_t bytes[5] = {0xc2, 0xf2}; + uint8_t bytes[] = {0xc2, 0xf2, 0x0, 0x0, 0x0}; [output writeRawData:[NSData dataWithBytes:bytes length:sizeof(bytes)]]; [output flush]; @@ -286,6 +289,7 @@ TestAllTypes* message = [TestAllTypes parseFromCodedInputStream:input extensionRegistry:nil error:NULL]; + XCTAssertNotNil(message); // Make sure we can read string properties twice without crashing. XCTAssertEqual([message.defaultString length], (NSUInteger)0); XCTAssertEqualObjects(@"", message.defaultString); |