MKMapView initWithFrame: Crashes when given negative frame sizes

Originator:paddy
Number:rdar://13860141 Date Originated:10-May-2013 12:31 PM
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 5.1
Classification:Other Bug Reproducible:Always
 
Summary: 
When instantiating MKMapView in code, the initializer will crash if given a frame that has a negative size in either or both directions.

Steps to Reproduce:
1.  include the code [[MKMapView allloc] initWithFrame:CGRectMake(0, 0, -100, -100)]; in a view controllers loadView method. 

Expected Results:
Calling [[MKMapView allloc] initWithFrame:CGRectMake(0, 0, -100, -100)]; returns nil like other UIView subclasses that cannot be instatiated.

Actual Results:
Calling [[MKMapView allloc] initWithFrame:CGRectMake(0, 0, -100, -100)]; causes the app to crash with EXEC_BAD_ACCESS

Regression:
Unknown, I don't have access to any iOS versions lower than 5.1

Notes:
This normally should not be an issue but if the maps frame is calculated at runtime it is possible that a negatively sized frames could result. In such cases MKMapView should behave like its parent class UIView and validate the frame and return nil if the view cannot be created.

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!