Fix UB in the integer overflow check in Layer::Layer()
[chromium-blink-merge.git] / third_party / ocmock / OCMock / OCMBoxedReturnValueProvider.m
blob04fda55a3a56bb220091807a82550a0b13b306ee
1 //---------------------------------------------------------------------------------------
2 //  $Id$
3 //  Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
4 //---------------------------------------------------------------------------------------
6 #import "OCMBoxedReturnValueProvider.h"
9 @implementation OCMBoxedReturnValueProvider
11 - (void)handleInvocation:(NSInvocation *)anInvocation
13         if(strcmp([[anInvocation methodSignature] methodReturnType], [(NSValue *)returnValue objCType]) != 0)
14                 @throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"Return value does not match method signature." userInfo:nil];
15         void *buffer = malloc([[anInvocation methodSignature] methodReturnLength]);
16         [returnValue getValue:buffer];
17         [anInvocation setReturnValue:buffer];
18         free(buffer);
21 @end