NSURL crash when subclassing

Originator:cedric.luthi
Number:rdar://9729706 Date Originated:06-Jul-2011 05:32 PM
Status:Duplicate/5456203 Resolved:
Product:iPhone SDK Product Version:4.3
Classification:Serious Bug Reproducible:Always
 
Summary:
NSURL crashes when it is subclassed and initialized with initWithString:relativeToURL: and an empty string.


Steps to Reproduce:
Compile and run the sample code at https://gist.github.com/1067463


Expected Results:
[NSURL] http://www.apple.com/iphone
[NSURL] http://www.apple.com
[MyURL] http://www.apple.com/iphone
[MyURL] http://www.apple.com


Actual Results:
[NSURL] http://www.apple.com/iphone
[NSURL] http://www.apple.com
[MyURL] http://www.apple.com/iphone
** crash in -[NSURL absoluteString] **

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   com.apple.CoreFoundation      	0x00007fff851aa1bd CFURLCopyAbsoluteURL + 61
1   com.apple.Foundation          	0x00007fff82bf8efc -[NSURL(NSURL) absoluteString] + 29
2   main                          	0x0000000100001c70 testInitURL + 304
3   main                          	0x0000000100001dce main + 286
4   main                          	0x0000000100001aa4 start + 52


Regression:
This crashes on Mac OS X 10.6.8 and iOS 4.3 (both simulator and device)


Notes:
The workaround is to not use -[NSURL initWithString:relativeToURL:]

Comments

28-May-2012 02:34 AM Cédric Luthi

I'm still experiencing the crash with iOS 5.1.1. Can you please reopen this bug report?

By cedric.luthi at May 28, 2012, 12:35 p.m. (reply...)

06-Jul-2011 07:02 PM Cédric Luthi

Yes, I'm also experiencing this issue with iOS 5.0b2.

By cedric.luthi at July 6, 2011, 5:03 p.m. (reply...)

06-Jul-2011 06:48 PM Patrick Collins

Engineering has requested the following information in order to further investigate this issue:

Could you please tell us if you're also experiencing this issue with iOS 5.0b2 (9A5248d)?

By cedric.luthi at July 6, 2011, 5:02 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!