• 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
A bug in CFPropertyListCreateFromXMLData?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A bug in CFPropertyListCreateFromXMLData?


  • Subject: A bug in CFPropertyListCreateFromXMLData?
  • From: Stéphane Sudre <email@hidden>
  • Date: Tue, 17 Dec 2002 11:33:28 +0100

I have some code which basically looks like this:

1 if (CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault,tURLRef,&r esourceData,NULL,NULL,&errorCode)==TRUE)
2 {
3 printf("error code: %d\n",errorCode);
4
5 tArray = (CFArrayRef) CFPropertyListCreateFromXMLData(kCFAllocatorDefault,
6 resourceData,
7 kCFPropertyListImmutable,
8 &errorString);
9
10 [...]
11 }

tURLRef is pointing to a file which contains garbage.

Line 1 is returning TRUE. And errorcode is 0

Then when line 5 is called, CFPropertyListCreateFromXMLData is crashing like this:

Program received signal EXC_BAD_ACCESS, Could not access memory.
0x90165614 in __CFFromUTF8 ()
(gdb) backtrace
#0 0x90165614 in __CFFromUTF8 ()
#1 0x901ac91c in __CFStringDecodeByteStream3 ()
#2 0x901abe1c in __CFStringCreateImmutableFunnel3 ()
#3 0x9cad002e in ?? ()

I understand and agree that the CoreFoundation API does not check everything to be fast, etc... But I would think it could at least avoid crashing in this case.

I'm beginning to wonder if this is not related to the new binary format of property list introduce in 10.2. The file should be a XML textual file and the garbage is ... well a piece of garbage. So maybe CoreFoundation is thinking it's a binary format and so launched its binary parser and got crashed because it's not protected against bad binary format.

I can add some checking to be sure that the file is beginning with a '<' but I believe the checking should be done by CoreFoundation on this one.

Important point: when the file is valid .plist text file, the code is working super fine.
_______________________________________________
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: A bug in CFPropertyListCreateFromXMLData?
      • From: Ali Ozer <email@hidden>
  • Prev by Date: Re: NSTableView - Alternating blue and white background
  • Next by Date: Re: NSTableView - Alternating blue and white background
  • Previous by thread: Re: NSTableView - Alternating blue and white background
  • Next by thread: Re: A bug in CFPropertyListCreateFromXMLData?
  • Index(es):
    • Date
    • Thread