iOS CoreText crash: EXC_BAD_ACCESS KERN_INVALID_ADDRESS while setting view height

1k views Asked by At

Following is the stack trace from Crashlytics, it crashes when text view's frame height is set: (I got EXC_BAD_ACCESS KERN_INVALID_ADDRESS and SIGABRT ABORT crash at the same line @objc UIView.height.setter (UIView+.swift))

EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x000000000000000d

Crashed: com.apple.main-thread
    0  CoreText                       0x194d24cd8 TOpenTypeMorph::SetLookups(OTL::GSUB&, unsigned int const*, OTL::GlyphLookups&) + 200
    1  CoreText                       0x194d24dd4 TOpenTypeMorph::SetLookups(OTL::GSUB&, unsigned int const*, OTL::GlyphLookups&) + 452
    2  CoreText                       0x194d25a40 void TOpenTypeMorph::ApplyShapingEngine<TInlineVector<unsigned int, 30ul> >(OTL::GSUB&, OTL::GlyphLookups&, unsigned int*, CFRange, TInlineVector<unsigned int, 30ul>&, SyncState&) + 1620
    3  CoreText                       0x194d24fac TOpenTypeMorph::ShapeGlyphs(SyncState&) + 340
    4  CoreText                       0x194cc4a4c TShapingEngine::ShapeGlyphs(TLine&, TCharStream const&) + 224
    5  CoreText                       0x194c8fa48 TTypesetter::TTypesetter(__CFArray const*, __CFString const*, void const* (*)(__CTRun const*, __CFString const*, void*), void*) + 188
    6  CoreText                       0x194c8f860 CTTypesetterCreateWithRunArray + 88
    7  UIFoundation                   0x197dffbb4 -[NSATSGlyphStorage createCTTypesetter] + 1512
    8  UIFoundation                   0x197dfa960 -[NSATSTypesetter _ctTypesetter] + 296
    9  UIFoundation                   0x197e03b14 -[NSATSLineFragment layoutForStartingGlyphAtIndex:characterIndex:minPosition:maxPosition:lineFragmentRect:] + 128
    10 UIFoundation                   0x197dfb534 -[NSATSTypesetter _layoutLineFragmentStartingWithGlyphAtIndex:characterIndex:atPoint:renderingContext:] + 2316
    11 UIFoundation                   0x197dfcaf8 -[NSATSTypesetter layoutParagraphAtPoint:] + 160
    12 UIFoundation                   0x197e53980 -[NSTypesetter _layoutGlyphsInLayoutManager:startingAtGlyphIndex:maxNumberOfLineFragments:maxCharacterIndex:nextGlyphIndex:nextCharacterIndex:] + 5692
    13 UIFoundation                   0x197e53da4 -[NSTypesetter layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments:] + 244
    14 UIFoundation                   0x197dfd558 -[NSATSTypesetter layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments:] + 448
    15 UIFoundation                   0x197de968c -[NSLayoutManager(NSPrivate) _fillLayoutHoleForCharacterRange:desiredNumberOfLines:isSoft:] + 1116
    16 UIFoundation                   0x197deb180 -[NSLayoutManager(NSPrivate) _fillLayoutHoleAtIndex:desiredNumberOfLines:] + 196
    17 UIFoundation                   0x197deb8b4 -[NSLayoutManager(NSPrivate) _markSelfAsDirtyForBackgroundLayout:] + 344
    18 UIFoundation                   0x197df477c -[NSLayoutManager(NSPrivate) _invalidateLayoutForExtendedCharacterRange:isSoft:invalidateUsage:] + 2292
    19 UIFoundation                   0x197e1dee8 -[NSLayoutManager textContainerChangedGeometry:] + 332
    20 UIFoundation                   0x197e40220 -[NSTextContainer setSize:] + 160
    21 UIKit                          0x197f74508 _UITextContainerViewResyncNSTextContainer + 264
    22 UIKit                          0x19890198c __64-[_UITextContainerView _setFrameOrBounds:oldRect:settingAction:]_block_invoke + 52
    23 UIKit                          0x198901878 -[_UITextContainerView _setFrameOrBounds:oldRect:settingAction:] + 308
    24 UIKit                          0x197f7436c -[_UITextContainerView setFrame:] + 188
    25 UIKit                          0x1988ee64c -[UITextView _resyncContainerFrameForNonAutolayoutDeferringSizeToFit:] + 644
    26 UIKit                          0x1988ef1b4 -[UITextView _setFrameOrBounds:fromOldRect:settingAction:] + 500
    27 UIKit                          0x197f73bf8 -[UITextView setFrame:] + 188
    28 MyAppCore                      0x1024ac944 @objc UIView.height.setter (UIView+.swift)
    29 MyAppShell                     0x1030a1cbc MyAppTextBaseCell.setSubviewFrames() -> () (MyAppTextBaseCell.swift)
    30 MyAppShell                     0x1059254e0 MyAppCollectionViewCell.layoutSubviews() -> () (MyAppCollectionViewCell.swift:215)
    31 MyAppShell                     0x1059255d4 @objc MyAppCollectionViewCell.layoutSubviews() -> () (MyAppCollectionViewCell.swift)
    32 UIKit                          0x197ec6220 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1196
    33 QuartzCore                     0x195386188 -[CALayer layoutSublayers] + 148
    34 QuartzCore                     0x19537ae64 CA::Layer::layout_if_needed(CA::Transaction*) + 292
    35 UIKit                          0x197edac90 -[UIView(Hierarchy) layoutBelowIfNeeded] + 1020
    36 MyAppLib                       0x100b56ea4 -[MyAppImpressionTracker reloadViewPortCellsWithCompletion:] (MyAppImpressionTracker.m:59)
    37 MyAppLib                       0x100b65f0c -[MyAppTracker viewPortWillRefresh:withReloadDataCompletion:] (MyAppTracker.m:150)
    38 MyAppShell                     0x1030d3440 MyAppViewController.reloadData() -> () (MyAppViewController.swift)
    39 MyAppFeed                      0x102a85ad4 MyAppViewController.providerHasUpdated(fromCache : Bool, hasInitialUpdates : Bool) -> () (MyAppViewController.swift)
    40 MyAppFeed                      0x102a85c80 @objc MyAppViewController.providerHasUpdated(fromCache : Bool, hasInitialUpdates : Bool) -> () (MyAppViewController.swift)
    41 MyAppFeed                      0x102a53030 protocol witness for MyAppProviderDelegate.providerHasUpdated(fromCache : Bool, hasInitialUpdates : Bool) -> () in conformance MyAppViewController (MyAppCellViewModel.swift)
    42 MyAppFeed                      0x102b35c84 specialized MyAppProvider.(updateSectionProviders(Bool, hasInitialUpdates : Bool, completion : () -> ()?) -> ()).(closure #2) (MyAppProvider.swift)
    43 MyAppFeed                      0x102b32380 partial apply for MyAppProvider.(updateSectionProviders(Bool, hasInitialUpdates : Bool, completion : () -> ()?) -> ()).(closure #2) (MyAppProvider.swift)
    44 MyAppCore                      0x10246188c partial apply for static GCD.(dispatchAsyncMyAppOperationQueue(() -> (), thenOnMainQueue : () -> ()?) -> ()).(closure #1).(closure #1) (QueueHelper.swift)
    45 libdispatch.dylib              0x190ef9200 _dispatch_call_block_and_release + 24
    46 libdispatch.dylib              0x190ef91c0 _dispatch_client_callout + 16
    47 libdispatch.dylib              0x190efdd6c _dispatch_main_queue_callback_4CF + 1000
    48 CoreFoundation                 0x19201bf2c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
    49 CoreFoundation                 0x192019b18 __CFRunLoopRun + 1660
    50 CoreFoundation                 0x191f48048 CFRunLoopRunSpecific + 444
    51 GraphicsServices               0x1939ce198 GSEventRunModal + 180
    52 UIKit                          0x197f342fc -[UIApplication _run] + 684
    53 UIKit                          0x197f2f034 UIApplicationMain + 208
    54 MyApp                          0x1000b344c main (AppDelegate.swift:27)
    55 libdispatch.dylib              0x190f2c5b8 (Missing)

As the crash logs are related to Glyph, it seems to be happening for some weird character/symbol may be in language other than english.

I have not been able to repro this crash, can someone please provide any pointer.

1

There are 1 answers

0
Himanshu Saini On

This is happening because of jña telugu character being received. It is an issue with older ios versions though. See this video.