Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / November 2004



Tip: Looking for answers? Try searching our database.

Bug with NSString (_CFStringAppendFormatAndArgumentsAux)?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gabriel Handford - 24 Nov 2004 22:34 GMT
Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x00000020

Thread 4 Crashed:
0   com.apple.CoreFoundation           0x9019ea38 _CFStringAppendFormatAndArgumentsAux + 0xd30
1   com.apple.CoreFoundation           0x901a4a4c _CFStringCreateWithFormatAndArgumentsAux + 0x90
2   com.apple.Foundation               0x90a5a7a8 NSLogv + 0x4c
3   com.apple.Foundation               0x90a74abc NSLog + 0x1c
4   com.cellardoorsw.RandomWeb         0x066a81e4 RWLog + 0x7c
5   com.cellardoorsw.RandomWeb         0x066a9854 -[Searcher didErrorOnImageDownload:error:count:] + 0x2c
6   com.cellardoorsw.RandomWeb         0x066a0674 -[ImageDownloadClient download:didFailWithError:] + 0x44
7   com.apple.Foundation               0x90b0e840 -[NSURLDownload _cancelWithError:] + 0xe4

I think it happens when I'm logging a URL which contains some weird characters.
I parse web pages and use regex to pull some URL and then eventually when I log that URL it crashes.
From some research in the pages that crash my app it looks like %2520 appear in the URL somewhere.
I use the standard Latin 1 encoding when I convert the NSData bytes to NSString form.

I tried "scrubbing" the string by getting its lossyCString representation and then using that but it always crashes.
Has anyone else seen this kind of crash before?

-gabe
Michael Ash - 25 Nov 2004 06:29 GMT
> Exception:  EXC_BAD_ACCESS (0x0001)
> Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x00000020
[quoted text clipped - 16 lines]
> I tried "scrubbing" the string by getting its lossyCString representation and then using that but it always crashes.
> Has anyone else seen this kind of crash before?

Let me guess, you're doing something like:

NSLog(stringIWantToDisplay);

Don't do that. If your string contains % characters, NSLog will see them
as format characters and will look for more arguments. Since you didn't
pass the proper arguments, you'll explode. Instead, do this:

NSLog(@"%@", stringIWantToDisplay);

If this isn't your problem, please post some code; without it, I can't do
more than guess.
Gabriel Handford - 29 Nov 2004 16:30 GMT
>>Exception:  EXC_BAD_ACCESS (0x0001)
>>Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x00000020
[quoted text clipped - 29 lines]
> If this isn't your problem, please post some code; without it, I can't do
> more than guess.

Yup thats it.. uh im so dumb... i always NSLog("%@", ) but for some reason on this line i didn't and my eyes couldnt see it..

Thanks!
-gabe
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.