NSTextContainer exclusionPaths hangs App on iOS 7.1

Originator:derkai
Number:rdar://16670440 Date Originated:20/04/2014
Status:Open Resolved:
Product:iOS Product Version:7.1
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
Using exlusionPaths on the textContainer property of UITextView leads to 100% CPU usage and huge amounts of used memory on iOS 7.1. The issue only seems to arise for certain UIBezierPath rects. In my case, the problem occurs when I create the  UIBezierPath with a CGRect whose origin.x is zero (i.e. settings the rect's origin.x to 1 fixes the issue). 

The problem does not exist on iOS 7.0

Steps to Reproduce:
1. Create a UITextView with some text
2. Create a UIBezierPath with a CGRect like CGRectMake(0, 0, 50, 50)
3. Set textView.textContainer.exclusionPaths array to include the UIBezierPath
4. Run the app

Expected Results:
The UITextView should render with a blank space in the (0, 0, 50, 50) rect and the App shouldn't hang or crash.

Actual Results:
The App hangs, CPU usage goes up to 100% and huge amounts (easily 1GB) of memory is used. After a few minutes the App crashes with malloc: *** mach_vm_map(size=1048576) failed (error code=3) *** error: can't allocate region

The problem is currently being discussed in the Apple Developer Forum at https://devforums.apple.com/message/960349#960349

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!