From 1da9ffe39496e59f439b126a232b7ae18a634aee Mon Sep 17 00:00:00 2001 From: Felix Jendrusch Date: Thu, 8 Mar 2018 16:20:37 +0100 Subject: Check return value on write of raw pointer --- objectivec/GPBCodedOutputStream.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'objectivec/GPBCodedOutputStream.m') diff --git a/objectivec/GPBCodedOutputStream.m b/objectivec/GPBCodedOutputStream.m index f832e8a6..b846c2fc 100644 --- a/objectivec/GPBCodedOutputStream.m +++ b/objectivec/GPBCodedOutputStream.m @@ -942,7 +942,10 @@ static void GPBWriteRawLittleEndian64(GPBOutputBufferState *state, state_.position = length; } else { // Write is very big. Let's do it all at once. - [state_.output write:((uint8_t *)value) + offset maxLength:length]; + NSInteger written = [state_.output write:((uint8_t *)value) + offset maxLength:length]; + if (written != (NSInteger)length) { + [NSException raise:GPBCodedOutputStreamException_WriteFailed format:@""]; + } } } } -- cgit v1.2.3