Raise and catch an exception if this isn't a Mach-O file, so at least

we don't seg fault.
This commit is contained in:
Steve Nygard 2005-07-03 07:23:58 +00:00
parent 513467af76
commit c1622113e3
3 changed files with 11 additions and 2 deletions

View File

@ -8,7 +8,7 @@
#include <regex.h>
#import "CDStructureRegistrationProtocol.h"
#define CLASS_DUMP_VERSION @"3.0"
#define CLASS_DUMP_VERSION @"3.1 (dev)"
@class NSMutableArray, NSMutableDictionary, NSMutableSet, NSMutableString, NSString;
@class CDDylibCommand, CDMachOFile;

View File

@ -341,7 +341,15 @@ static NSMutableSet *wrapperExtensions = nil;
aMachOFile = [[CDMachOFile alloc] initWithFilename:aFilename];
[aMachOFile setDelegate:self];
[aMachOFile process];
// TODO (2005-07-03): Look for the newer exception handling stuff.
NS_DURING {
[aMachOFile process];
} NS_HANDLER {
NSLog(@"Caught exception in %s", _cmd);
[aMachOFile release];
return;
} NS_ENDHANDLER;
aProcessor = [[CDObjCSegmentProcessor alloc] initWithMachOFile:aMachOFile];
[aProcessor process];

View File

@ -65,6 +65,7 @@
NSLog(@"Not a Mach-O file.");
// TODO (2003-12-14): Perhaps raise an exception or something.
[NSException raise:NSGenericException format:@"Not a Mach-O file..."];
}
loadCommands = [[self _processLoadCommands] retain];