Bug 31090 - GetBoundingRect crash with some special characters
Summary: GetBoundingRect crash with some special characters
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 8.10
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-06-13 13:06 UTC by heebaek choi
Modified: 2015-07-02 06:22 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Self contained test... (4.84 KB, application/x-gzip)
2015-06-17 13:55 UTC, Paola Villarreal
Details
my test case (10.84 KB, application/zip)
2015-06-17 20:42 UTC, heebaek choi
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description heebaek choi 2015-06-13 13:06:00 UTC
i used GetBoundingRect for calculate size of text. 
my user post some special characters(as text emoticon) and i found this bug. 

var text = new NSString("effective\nPower\nلُلُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ\n冗");
var rect = text.GetBoundingRect() -> crash

if i test a normal text like a "Hello" it works without crash.

my app is live status.. so please check this and let me know any workaround...
Comment 1 Paola Villarreal 2015-06-16 18:02:01 UTC
Could you share your options for GetBoundingRect? Trying to reproduce the crash with the following code but it won't crash:

var text = new NSString("effective\nPower\nلُلُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ\n冗");
var rect = text.GetBoundingRect (new CoreGraphics.CGSize (100, 20), NSStringDrawingOptions.UsesDeviceMetrics, new UIStringAttributes (), new NSStringDrawingContext ());
Console.WriteLine ("Here i am, " + rect);

Thanks!
Comment 2 heebaek choi 2015-06-17 03:00:07 UTC
I found very weird crash in a test with your feedback.

you can see the crash in this code.

var text = new NSString("effective\ nPower\ nلُلُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ\ n冗");

var rect = text.GetBoundingRect (new CoreGraphics.CGSize (100, 40), NSStringDrawingOptions.UsesLineFragmentOrigin, new UIStringAttributes () { Font = UIFont.SystemFontOfSize(14) }, new NSStringDrawingContext ());


if you use CGSize(100, 20) -> not crash, maybe related to multiline calculation.
 
NSStringDrawingOptions.UsesLineFragmentOrigin -> must set for see the crash (i think this option is about multiline too)

new UIStringAttributes () { Font = UIFont.SystemFontOfSize(14) } -> if you not assign font, may not crash

new NSStringDrawingContext () -> i used null for this but in this time, just use your code, i did not care about this option and don't know about it.

Thanks.
Comment 3 Paola Villarreal 2015-06-17 13:45:22 UTC
Hello, still no crash on my side, could you try with the attached test project?
Comment 4 Paola Villarreal 2015-06-17 13:55:41 UTC
Created attachment 11648 [details]
Self contained test...
Comment 5 heebaek choi 2015-06-17 20:42:59 UTC
Created attachment 11658 [details]
my test case
Comment 6 heebaek choi 2015-06-17 20:50:14 UTC
I can't run your project because i am indie user and your project need to business plan upgrade.
But i saw your code was same to me(except i tested in view controller but you tested in appDelegate), and same code crashed in my project.
Please check my attachment.
Thanks.
Comment 7 Paola Villarreal 2015-06-20 12:40:23 UTC
I got the crash with your code.... 

Please confirm this is the same you are getting... 

2015-06-20 11:38:24.921 test2[242:12280] critical: Stacktrace:
2015-06-20 11:38:24.922 test2[242:12280] critical:   at <unknown> <0xffffffff>
2015-06-20 11:38:24.922 test2[242:12280] critical:   at (wrapper managed-to-native) ObjCRuntime.Messaging.CGRect_objc_msgSend_CGSize_UInt64_IntPtr_IntPtr (intptr,intptr,CoreGraphics.CGSize,ulong,intptr,intptr) <0xffffffff>
2015-06-20 11:38:24.922 test2[242:12280] critical:   at UIKit.NSExtendedStringDrawing.WeakGetBoundingRect (Foundation.NSString,CoreGraphics.CGSize,Foundation.NSStringDrawingOptions,Foundation.NSDictionary,Foundation.NSStringDrawingContext) [0x0001b] in /Users/builder/data/lanes/1799/3c4e832a/source/maccore/src/build/ios/native/UIKit/NSExtendedStringDrawing.g.cs:80
2015-06-20 11:38:24.923 test2[242:12280] critical:   at UIKit.NSExtendedStringDrawing.GetBoundingRect (Foundation.NSString,CoreGraphics.CGSize,Foundation.NSStringDrawingOptions,UIKit.UIStringAttributes,Foundation.NSStringDrawingContext) [0x00000] in /Users/builder/data/lanes/1799/3c4e832a/source/maccore/src/build/ios/native/UIKit/NSExtendedStringDrawing.g.cs:51
2015-06-20 11:38:24.923 test2[242:12280] critical:   at test2.ViewController.DoTest () [0x00040] in /Users/paw/Downloads/test2/test2/ViewController.cs:54
2015-06-20 11:38:24.923 test2[242:12280] critical:   at test2.ViewController.ViewDidAppear (bool) [0x00009] in /Users/paw/Downloads/test2/test2/ViewController.cs:28
2015-06-20 11:38:24.924 test2[242:12280] critical:   at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
2015-06-20 11:38:24.924 test2[242:12280] critical:   at <unknown> <0xffffffff>
2015-06-20 11:38:24.924 test2[242:12280] critical:   at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <0xffffffff>
2015-06-20 11:38:24.925 test2[242:12280] critical:   at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /Users/builder/data/lanes/1799/3c4e832a/source/maccore/src/UIKit/UIApplication.cs:63
2015-06-20 11:38:24.925 test2[242:12280] critical:   at UIKit.UIApplication.Main (string[],string,string) [0x0001c] in /Users/builder/data/lanes/1799/3c4e832a/source/maccore/src/UIKit/UIApplication.cs:46
2015-06-20 11:38:24.925 test2[242:12280] critical:   at test2.Application.Main (string[]) [0x00008] in /Users/paw/Downloads/test2/test2/Main.cs:12
2015-06-20 11:38:24.926 test2[242:12280] critical:   at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
2015-06-20 11:38:24.926 test2[242:12280] critical: 
Native stacktrace:

2015-06-20 11:38:24.968 test2[242:12280] critical: 	0   test2                               0x00000001002c7938 mono_handle_native_sigsegv + 264
2015-06-20 11:38:24.969 test2[242:12280] critical: 	1   test2                               0x00000001002d1c0c mono_sigsegv_signal_handler + 324
2015-06-20 11:38:24.969 test2[242:12280] critical: 	2   libsystem_platform.dylib            0x00000001974d095c _sigtramp + 68
2015-06-20 11:38:24.969 test2[242:12280] critical: 	3   CoreText                            0x0000000185f19ce8 <redacted> + 704
2015-06-20 11:38:24.969 test2[242:12280] critical: 	4   CoreText                            0x0000000185f19ce8 <redacted> + 704
2015-06-20 11:38:24.970 test2[242:12280] critical: 	5   CoreText                            0x0000000185f1a7d4 <redacted> + 296
2015-06-20 11:38:24.970 test2[242:12280] critical: 	6   CoreText                            0x0000000185ed2f64 <redacted> + 268
2015-06-20 11:38:24.970 test2[242:12280] critical: 	7   CoreText                            0x0000000185ed57c8 <redacted> + 132
2015-06-20 11:38:24.970 test2[242:12280] critical: 	8   CoreText                            0x0000000185e9bdf8 <redacted> + 540
2015-06-20 11:38:24.970 test2[242:12280] critical: 	9   CoreText                            0x0000000185e9baf4 <redacted> + 128
2015-06-20 11:38:24.971 test2[242:12280] critical: 	10  CoreText                            0x0000000185e9b904 CTLineCreateWithAttributedString + 72
2015-06-20 11:38:24.971 test2[242:12280] critical: 	11  UIFoundation                        0x000000019328bea0 <redacted> + 14880
2015-06-20 11:38:24.971 test2[242:12280] critical: 	12  UIFoundation                        0x0000000193288434 <redacted> + 160
2015-06-20 11:38:24.971 test2[242:12280] critical: 	13  test2                               0x000000010012a798 wrapper_managed_to_native_ObjCRuntime_Messaging_CGRect_objc_msgSend_CGSize_UInt64_IntPtr_IntPtr_intptr_intptr_CoreGraphics_CGSize_ulong_intptr_intptr + 152
2015-06-20 11:38:24.971 test2[242:12280] critical: 	14  test2                               0x0000000100110f74 UIKit_NSExtendedStringDrawing_WeakGetBoundingRect_Foundation_NSString_CoreGraphics_CGSize_Foundation_NSStringDrawingOptions_Foundation_NSDictionary_Foundation_NSStringDrawingContext + 260
2015-06-20 11:38:24.972 test2[242:12280] critical: 	15  test2                               0x0000000100110e30 UIKit_NSExtendedStringDrawing_GetBoundingRect_Foundation_NSString_CoreGraphics_CGSize_Foundation_NSStringDrawingOptions_UIKit_UIStringAttributes_Foundation_NSStringDrawingContext + 160
2015-06-20 11:38:24.972 test2[242:12280] critical: 	16  test2                               0x00000001000ecb34 test2_ViewController_DoTest + 708
2015-06-20 11:38:24.972 test2[242:12280] critical: 	17  test2                               0x00000001000ec83c test2_ViewController_ViewDidAppear_bool + 188
2015-06-20 11:38:24.972 test2[242:12280] critical: 	18  test2                               0x000000010024aab4 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 180
2015-06-20 11:38:24.973 test2[242:12280] critical: 	19  test2                               0x00000001002d3e44 mono_jit_runtime_invoke + 1260
2015-06-20 11:38:24.973 test2[242:12280] critical: 	20  test2                               0x0000000100321c64 mono_runtime_invoke + 128
2015-06-20 11:38:24.974 test2[242:12280] critical: 	21  test2                               0x000000010029a470 native_to_managed_trampoline_7 + 248
2015-06-20 11:38:24.974 test2[242:12280] critical: 	22  test2                               0x000000010029ac04 -[ViewController viewDidAppear:] + 92
2015-06-20 11:38:24.974 test2[242:12280] critical: 	23  UIKit                               0x0000000189ed7fc0 <redacted> + 592
2015-06-20 11:38:24.974 test2[242:12280] critical: 	24  UIKit                               0x0000000189f442d8 <redacted> + 64
2015-06-20 11:38:24.974 test2[242:12280] critical: 	25  UIKit                               0x0000000189f44240 <redacted> + 356
2015-06-20 11:38:24.975 test2[242:12280] critical: 	26  UIKit                               0x0000000189eb4714 <redacted> + 576
2015-06-20 11:38:24.975 test2[242:12280] critical: 	27  CoreFoundation                      0x00000001854382a4 <redacted> + 32
2015-06-20 11:38:24.975 test2[242:12280] critical: 	28  CoreFoundation                      0x0000000185435230 <redacted> + 360
2015-06-20 11:38:24.975 test2[242:12280] critical: 	29  CoreFoundation                      0x0000000185435610 <redacted> + 836
2015-06-20 11:38:24.976 test2[242:12280] critical: 	30  CoreFoundation                      0x00000001853612d4 CFRunLoopRunSpecific + 396
2015-06-20 11:38:24.976 test2[242:12280] critical: 	31  GraphicsServices                    0x000000018eb776fc GSEventRunModal + 168
2015-06-20 11:38:24.976 test2[242:12280] critical: 	32  UIKit                               0x0000000189f26fac UIApplicationMain + 1488
2015-06-20 11:38:24.976 test2[242:12280] critical: 	33  test2                               0x000000010012a98c wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 348
2015-06-20 11:38:24.976 test2[242:12280] critical: 	34  test2                               0x000000010010960c UIKit_UIApplication_Main_string___intptr_intptr + 44
2015-06-20 11:38:24.977 test2[242:12280] critical: 	35  test2                               0x00000001001095cc UIKit_UIApplication_Main_string___string_string + 172
2015-06-20 11:38:24.977 test2[242:12280] critical: 	36  test2                               0x00000001000ec11c test2_Application_Main_string__ + 156
2015-06-20 11:38:24.977 test2[242:12280] critical: 	37  test2                               0x000000010024aab4 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 180
2015-06-20 11:38:24.977 test2[242:12280] critical: 	38  test2                               0x00000001002d3e44 mono_jit_runtime_invoke + 1260
2015-06-20 11:38:24.977 test2[242:12280] critical: 	39  test2                               0x0000000100321c64 mono_runtime_invoke + 128
2015-06-20 11:38:24.977 test2[242:12280] critical: 	40  test2                               0x0000000100325ef0 mono_runtime_exec_main + 404
2015-06-20 11:38:24.978 test2[242:12280] critical: 	41  test2                               0x0000000100387d2c xamarin_main + 1844
2015-06-20 11:38:24.978 test2[242:12280] critical: 	42  test2                               0x000000010029b5e0 main + 96
2015-06-20 11:38:24.978 test2[242:12280] critical: 	43  libdyld.dylib                       0x0000000197322a08 <redacted> + 4
2015-06-20 11:38:24.978 test2[242:12280] critical: 
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================
Comment 8 heebaek choi 2015-06-20 13:05:43 UTC
Here is mine. result on emulator (iPhone 4s iOS8.3)
Little bit short, but may be the same with you.

2015-06-21 01:57:44.642 test2[771:8230] critical:   at <unknown> <0xffffffff>
2015-06-21 01:57:44.642 test2[771:8230] critical:   at (wrapper managed-to-native) ObjCRuntime.Messaging.CGRect_objc_msgSend_stret_CGSize_UInt32_IntPtr_IntPtr (CoreGraphics.CGRect&,intptr,intptr,CoreGraphics.CGSize,uint,intptr,intptr) <IL 0x00034, 0xffffffff>
2015-06-21 01:57:44.642 test2[771:8230] critical:   at UIKit.NSExtendedStringDrawing.WeakGetBoundingRect (Foundation.NSString,CoreGraphics.CGSize,Foundation.NSStringDrawingOptions,Foundation.NSDictionary,Foundation.NSStringDrawingContext) [0x000ea] in /Users/builder/data/lanes/1503/e6ebd18b/source/maccore/src/build/ios/native/UIKit/NSExtendedStringDrawing.g.cs:87
2015-06-21 01:57:44.642 test2[771:8230] critical:   at UIKit.NSExtendedStringDrawing.GetBoundingRect (Foundation.NSString,CoreGraphics.CGSize,Foundation.NSStringDrawingOptions,UIKit.UIStringAttributes,Foundation.NSStringDrawingContext) [0x00000] in /Users/builder/data/lanes/1503/e6ebd18b/source/maccore/src/build/ios/native/UIKit/NSExtendedStringDrawing.g.cs:51
2015-06-21 01:57:44.643 test2[771:8230] critical:   at test2.AppDelegate.FinishedLaunching (UIKit.UIApplication,Foundation.NSDictionary) [0x00040] in /Users/bobaman/Documents/102/source/xamarin/test2/test2/AppDelegate.cs:27
2015-06-21 01:57:44.643 test2[771:8230] critical:   at (wrapper runtime-invoke) <Module>.runtime_invoke_bool__this___object_object (object,intptr,intptr,intptr) <IL 0x00076, 0xffffffff>
2015-06-21 01:57:44.643 test2[771:8230] critical:   at <unknown> <0xffffffff>
2015-06-21 01:57:44.643 test2[771:8230] critical:   at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x000ae, 0xffffffff>
2015-06-21 01:57:44.787 test2[771:8230] critical:   at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /Users/builder/data/lanes/1503/e6ebd18b/source/maccore/src/UIKit/UIApplication.cs:63
2015-06-21 01:57:44.787 test2[771:8230] critical:   at UIKit.UIApplication.Main (string[],string,string) [0x00038] in /Users/builder/data/lanes/1503/e6ebd18b/source/maccore/src/UIKit/UIApplication.cs:47
2015-06-21 01:57:44.787 test2[771:8230] critical:   at test2.Application.Main (string[]) [0x00008] in /Users/bobaman/Documents/102/source/xamarin/test2/test2/Main.cs:12
2015-06-21 01:57:44.788 test2[771:8230] critical:   at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00060, 0xffffffff>
2015-06-21 01:57:44.788 test2[771:8230] critical: 
Native stacktrace:

2015-06-21 01:57:44.788 test2[771:8230] critical: 
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================
Comment 9 heebaek choi 2015-06-20 13:12:39 UTC
Oh i am sorry,  i downloaded my attachment and repost my result.

May be the same result. different is only call location. 


2015-06-21 02:08:12.169 test2[993:15345] critical: Stacktrace:

2015-06-21 02:08:12.169 test2[993:15345] critical:   at <unknown> <0xffffffff>
2015-06-21 02:08:12.169 test2[993:15345] critical:   at (wrapper managed-to-native) ObjCRuntime.Messaging.CGRect_objc_msgSend_stret_CGSize_UInt32_IntPtr_IntPtr (CoreGraphics.CGRect&,intptr,intptr,CoreGraphics.CGSize,uint,intptr,intptr) <IL 0x00034, 0xffffffff>
2015-06-21 02:08:12.169 test2[993:15345] critical:   at UIKit.NSExtendedStringDrawing.WeakGetBoundingRect (Foundation.NSString,CoreGraphics.CGSize,Foundation.NSStringDrawingOptions,Foundation.NSDictionary,Foundation.NSStringDrawingContext) [0x000ea] in /Users/builder/data/lanes/1503/e6ebd18b/source/maccore/src/build/ios/native/UIKit/NSExtendedStringDrawing.g.cs:87
2015-06-21 02:08:12.169 test2[993:15345] critical:   at UIKit.NSExtendedStringDrawing.GetBoundingRect (Foundation.NSString,CoreGraphics.CGSize,Foundation.NSStringDrawingOptions,UIKit.UIStringAttributes,Foundation.NSStringDrawingContext) [0x00000] in /Users/builder/data/lanes/1503/e6ebd18b/source/maccore/src/build/ios/native/UIKit/NSExtendedStringDrawing.g.cs:51
2015-06-21 02:08:12.170 test2[993:15345] critical:   at test2.ViewController.DoTest () [0x00040] in /Users/bobaman/Documents/102/source/xamarin/test2/test2/ViewController.cs:54
2015-06-21 02:08:12.170 test2[993:15345] critical:   at test2.ViewController.ViewDidAppear (bool) [0x00009] in /Users/bobaman/Documents/102/source/xamarin/test2/test2/ViewController.cs:28
2015-06-21 02:08:12.170 test2[993:15345] critical:   at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___byte (object,intptr,intptr,intptr) <IL 0x00064, 0xffffffff>
2015-06-21 02:08:12.170 test2[993:15345] critical:   at <unknown> <0xffffffff>
2015-06-21 02:08:12.170 test2[993:15345] critical:   at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x000ae, 0xffffffff>
2015-06-21 02:08:12.170 test2[993:15345] critical:   at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /Users/builder/data/lanes/1503/e6ebd18b/source/maccore/src/UIKit/UIApplication.cs:63
2015-06-21 02:08:12.170 test2[993:15345] critical:   at UIKit.UIApplication.Main (string[],string,string) [0x00038] in /Users/builder/data/lanes/1503/e6ebd18b/source/maccore/src/UIKit/UIApplication.cs:47
2015-06-21 02:08:12.171 test2[993:15345] critical:   at test2.Application.Main (string[]) [0x00008] in /Users/bobaman/Documents/102/source/xamarin/test2/test2/Main.cs:12
2015-06-21 02:08:12.171 test2[993:15345] critical:   at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00060, 0xffffffff>
2015-06-21 02:08:12.171 test2[993:15345] critical: 
Native stacktrace:

2015-06-21 02:08:12.171 test2[993:15345] critical: 
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================
Comment 10 heebaek choi 2015-07-02 05:28:21 UTC
This bug fixed after iOS 8.4 update.

Thanks.
Comment 11 Udham Singh 2015-07-02 06:21:48 UTC
As per comment 10, this issue is resolved for user after iOS 8.4 update. Hence I am closing this issue.

Thanks!