• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Feeding NSUnarchiver bad data can cause crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feeding NSUnarchiver bad data can cause crash


  • Subject: Re: Feeding NSUnarchiver bad data can cause crash
  • From: Jeremy Dronfield <email@hidden>
  • Date: Thu, 3 Jun 2004 14:00:39 +0100

On 3 Jun 2004, at 12:14 pm, Douglas A. Welton wrote:
NS_DURING
Library = [[NSUnarchiver unarchiveObjectWithFile: Target_File] retain];
NS_HANDLER
//+
// Put up an error dialog for the user and perform
// an alternate initialization for the Library
//-

NSBeginInformationalAlertSheet( @"Oak Library", @"Continue", nil, nil,
Main_Window, nil, NULL, NULL, nil,
@"Error message goes here" );
Library = [[[Oak_Sources alloc] init] retain];
NS_ENDHANDLER

Hi Douglas

Yes, I tried something like this before. My version (suited to the particular case, where I'm passing the unarchiver decrypted data retrieved from an encrypted property list) is this:

NS_DURING
theText = [NSUnarchiver unarchiveObjectWithData:plaintext]; // CRASH!!
NS_HANDLER
if ([[localException name] isEqualToString:NSMallocException])
NSLog(@"malloc exception");
theText = nil;
success = NO;
NS_ENDHANDLER

It doesn't work. The error isn't handled. This is why I lament the lack of an ability to do something like, if ([plaintext canBeUnarchived]) or, if ([plaintext conformsToArchiving]).

Regards,
-Jeremy
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Feeding NSUnarchiver bad data can cause crash
      • From: "Douglas A. Welton" <email@hidden>
References: 
 >Re: Feeding NSUnarchiver bad data can cause crash (From: "Douglas A. Welton" <email@hidden>)

  • Prev by Date: Debugging under 10.2
  • Next by Date: Undo Problem - Dot Not Returning After Save
  • Previous by thread: Re: Feeding NSUnarchiver bad data can cause crash
  • Next by thread: Re: Feeding NSUnarchiver bad data can cause crash
  • Index(es):
    • Date
    • Thread