Permalink
Browse files

Merge pull request #308 from shu223/master

Fixed the array access beyond bounds.
  • Loading branch information...
2 parents df9dd09 + 27812f0 commit 140fbb3b2b4d28f495db83ac7abedf543381e3a5 @tomaz tomaz committed Feb 2, 2013
Showing with 2 additions and 2 deletions.
  1. +1 −1 Model/GBMethodData.m
  2. +1 −1 Processing/GBCommentsProcessor.m
View
@@ -204,7 +204,7 @@ - (BOOL)formatTypesFromArray:(NSArray *)types toArray:(NSMutableArray *)array pr
if (isLast || isPointer) appendSpace = NO;
// We should not add space between components of a protocol (i.e. id<ProtocolName> should be written without any space). Because we've alreay
- if (!isLast && [[types objectAtIndex:idx+1] isEqualToString:@"<"])
+ if (!isLast && idx+1 < [types count] && [[types objectAtIndex:idx+1] isEqualToString:@"<"])
insideProtocol = YES;
else if ([type isEqualToString:@">"])
insideProtocol = NO;
@@ -406,7 +406,7 @@ - (BOOL)processAvailabilityBlockInString:(NSString *)string lines:(NSArray *)lin
if ([components count] == 0) return NO;
// Get data from captures. Index 1 is directive, index 2 description text.
- NSString *description = [components objectAtIndex:3];
+ NSString *description = [components count] > 3 ? [components objectAtIndex:3] : @"";
NSRange range = [string rangeOfString:description];
NSString *prefix = nil;
if (range.location < [string length]) {

0 comments on commit 140fbb3

Please sign in to comment.