Skip to content

Crash in RNSVGSvgView defineClipPath:clipPathName: #2715

Open
@jb4e

Description

@jb4e

Description

When loading a SVG via URI, our app crashes with the stack below. The specific URI is https://www.healthcoachinstitute.com/wp-content/uploads/2021/03/HCI-logo-symbol-color.svg. AI identified what I suspect could be the issue with this SVG based on the stack: "There are duplicate clipPath IDs like clip24 and clip25 which appear twice with different suffixes (clip24-3, clip25-7). This violates SVG standards.".

The SVG renders fine in a browser and my mac, and everywhere else I've tried.

We identified this in our release production build, but it repros in a debug build as well.

Last Exception Backtrace:
0 CoreFoundation 0x18304b21c __exceptionPreprocess + 164 (NSException.m:249)
1 libobjc.A.dylib 0x1804e5abc objc_exception_throw + 88 (objc-exception.mm:356)
2 CoreFoundation 0x182f57790 -[__NSDictionaryM setObject:forKey:] + 1068 (NSDictionaryM.m:191)
3 Deglaze 0x100e6c61c -[RNSVGSvgView defineClipPath:clipPathName:] + 108 (RNSVGSvgView.mm:408)
4 Deglaze 0x100e51d20 -[RNSVGClipPath parseReference] + 84 (RNSVGClipPath.mm:62)
5 Deglaze 0x100e527dc __27-[RNSVGDefs parseReference]_block_invoke + 60 (RNSVGDefs.mm:56)
6 Deglaze 0x100e60ae4 -[RNSVGNode traverseSubviews:] + 168 (RNSVGNode.mm:608)
7 Deglaze 0x100e5b244 _28-[RNSVGGroup parseReference]block_invoke + 60 (RNSVGGroup.mm:287)
8 Deglaze 0x100e60ae4 -[RNSVGNode traverseSubviews:] + 168 (RNSVGNode.mm:608)
9 Deglaze 0x100e5b1b8 -[RNSVGGroup parseReference] + 188 (RNSVGGroup.mm:285)
10 Deglaze 0x100e6be64 -[RNSVGSvgView drawToContext:withRect:] + 796 (RNSVGSvgView.mm:310)
11 Deglaze 0x100e6bfec -[RNSVGSvgView drawRect:] + 136 (RNSVGSvgView.mm:331)
12 UIKitCore 0x185925818 -[UIView(CALayerDelegate) drawLayer:inContext:] + 624 (UIView.m:19603)
13 QuartzCore 0x184b58fe8 CABackingStoreUpdate
+ 240 (CABackingStore.cpp:1329)
14 QuartzCore 0x184b58ed8 invocation function for block in CA::Layer::display
() + 120 (CALayer.mm:10349)
15 QuartzCore 0x184b58480 -[CALayer _display] + 1512 (CALayer.mm:10403)
16 QuartzCore 0x184abd694 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 420 (CALayer.mm:2648)
17 QuartzCore 0x184abf7f8 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 476 (CAContextInternal.mm:2613)
18 QuartzCore 0x184abecc0 CA::Transaction::commit() + 644 (CATransactionInternal.mm:420)
19 QuartzCore 0x184abe938 CA::Transaction::flush_as_runloop_observer(bool) + 88 (CATransactionInternal.mm:928)
20 UIKitCore 0x185829e70 _UIApplicationFlushCATransaction + 52 (UIApplication.m:3321)
21 UIKitCore 0x185829e0c __setupUpdateSequence_block_invoke_2 + 336 (_UIUpdateScheduler.m:1659)
22 UIKitCore 0x185829404 _UIUpdateSequenceRun + 84 (_UIUpdateSequence.mm:136)
23 UIKitCore 0x185828ab4 schedulerStepScheduledMainSection + 208 (_UIUpdateScheduler.m:1173)
24 UIKitCore 0x1858241e4 runloopSourceCallback + 92 (_UIUpdateScheduler.m:1341)
25 CoreFoundation 0x182f40a8c CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 28 (CFRunLoop.c:1970)
26 CoreFoundation 0x182f408a4 __CFRunLoopDoSource0 + 172 (CFRunLoop.c:2014)
27 CoreFoundation 0x182f40700 __CFRunLoopDoSources0 + 232 (CFRunLoop.c:2051)
28 CoreFoundation 0x182f41080 __CFRunLoopRun + 840 (CFRunLoop.c:2969)
29 CoreFoundation 0x182f42c3c CFRunLoopRunSpecific + 572 (CFRunLoop.c:3434)
30 GraphicsServices 0x1d0121454 GSEventRunModal + 168 (GSEvent.c:2196)
31 UIKitCore 0x185955274 -[UIApplication _run] + 816 (UIApplication.m:3845)
32 UIKitCore 0x185920a28 UIApplicationMain + 336 (UIApplication.m:5540)
33 Deglaze 0x100928050 main + 80 (main.m:7)
34 dyld 0x1a9e17f08 start + 6040 (dyldMain.cpp:1450)

Steps to reproduce

<SvgUri uri="https://www.healthcoachinstitute.com/wp-content/uploads/2021/03/HCI-logo-symbol-color.svg" width="100%" height="100%" />

The SVG:
Image

Snack or a link to a repository

https://snack.expo.dev/@jacob_deglaze/reactnativesvgcrash

SVG version

15.12.0

React Native version

0.76.9

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native

Architecture

Fabric (New Architecture)

Build type

Release app & production bundle

Device

None

Device model

No response

Acknowledgements

Yes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions