NSURL crash when subclassed

Originator:cedric.luthi
Number:rdar://11545321 Date Originated:28-May-2012 09:10 PM
Status:Duplicate/5456203 Resolved:
Product:Mac OS X SDK Product Version:10.7.4
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] **

OS Version:      Mac OS X 10.7.4 (11E53)

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.CoreFoundation      	0x00007fff8b0d16fc CFURLCopyAbsoluteURL + 44
1   com.apple.Foundation          	0x00007fff8f139516 -[NSURL(NSURL) absoluteString] + 31
2   NSURLBug                      	0x000000010f696d20 testURL + 160
3   NSURLBug                      	0x000000010f696e4c main + 268
4   NSURLBug                      	0x000000010f696c74 start + 52


Regression:
This crashes on Mac OS X 10.7.4 and iOS 5.1.1 (both simulator and device)


Notes:
I originally filed this bug as rdar://problem/9729706 but it was improperly closed.

Comments


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!