You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[_ASDisplayLayer] Add protection around setting a layer’s position and transform (#2116)
There is built in protection around setting invalid bounds for `_ASDisplayLayer`. Let’s extend this to also include protecting against setting an invalid position and an invalid transform.
BOOL valid = ASDisplayNodeAssertNonFatal(ASIsCGPositionValidForLayout(position), @"Caught attempt to set invalid position %@ on %@.", NSStringFromCGPoint(position), self);
45
+
if (!valid) {
46
+
return;
47
+
}
48
+
49
+
[supersetPosition:position];
50
+
}
51
+
52
+
- (void)setTransform:(CATransform3D)transform
53
+
{
54
+
BOOL valid = ASDisplayNodeAssertNonFatal(ASIsTransformValidForLayout(transform), @"Caught attempt to set invalid transform on %@.", self);
55
+
if (!valid) {
56
+
return;
57
+
}
58
+
59
+
[supersetTransform:transform];
60
+
}
61
+
42
62
- (void)setBounds:(CGRect)bounds
43
63
{
44
64
BOOL valid = ASDisplayNodeAssertNonFatal(ASIsCGRectValidForLayout(bounds), @"Caught attempt to set invalid bounds %@ on %@.", NSStringFromCGRect(bounds), self);
0 commit comments