Index: third_party/protobuf/objectivec/GPBCodedInputStream.m |
diff --git a/third_party/protobuf/objectivec/GPBCodedInputStream.m b/third_party/protobuf/objectivec/GPBCodedInputStream.m |
index fd8778383d9ed4db1f10daf283ecd301e2a81bb2..319ec15ba7c81dbb7627b50339ea603619db853e 100644 |
--- a/third_party/protobuf/objectivec/GPBCodedInputStream.m |
+++ b/third_party/protobuf/objectivec/GPBCodedInputStream.m |
@@ -219,15 +219,16 @@ NSString *GPBCodedInputStreamReadRetainedString( |
result = [[NSString alloc] initWithBytes:&state->bytes[state->bufferPos] |
length:size |
encoding:NSUTF8StringEncoding]; |
+ state->bufferPos += size; |
if (!result) { |
- result = @""; |
#ifdef DEBUG |
// https://developers.google.com/protocol-buffers/docs/proto#scalar |
- NSLog(@"UTF8 failure, is some field type 'string' when it should be " |
+ NSLog(@"UTF-8 failure, is some field type 'string' when it should be " |
@"'bytes'?"); |
#endif |
+ [NSException raise:NSParseErrorException |
+ format:@"Invalid UTF-8 for a 'string'"]; |
} |
- state->bufferPos += size; |
} |
return result; |
} |
@@ -359,6 +360,14 @@ void GPBCodedInputStreamCheckLastTagWas(GPBCodedInputStreamState *state, |
} |
} |
+- (BOOL)isAtEnd { |
+ return GPBCodedInputStreamIsAtEnd(&state_); |
+} |
+ |
+- (size_t)position { |
+ return state_.bufferPos; |
+} |
+ |
- (double)readDouble { |
return GPBCodedInputStreamReadDouble(&state_); |
} |