Browse Source

Don't call other methods on target in performSelector:

Tanner Bennett 6 years ago
parent
commit
9645811baa
1 changed files with 10 additions and 1 deletions
  1. 10 1
      Classes/Utility/Runtime/FLEXRuntimeUtility.m

+ 10 - 1
Classes/Utility/Runtime/FLEXRuntimeUtility.m

@@ -297,6 +297,16 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
         return nil;
     }
 
+    NSMethodSignature *methodSignature = [NSMethodSignature signatureWithObjCTypes:({
+        Method method;
+        if (object_isClass(object)) {
+            method = class_getClassMethod(object, selector);
+        } else {
+            method = class_getInstanceMethod(object_getClass(object), selector);
+        }
+        method_getTypeEncoding(method);
+    })];
+    
     // Probably an unsupported type encoding, like bitfields.
     // In the future, we could calculate the return length
     // on our own. For now, we abort.
@@ -305,7 +315,6 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
     // NSMethodSignature will convert {?=b8b4b1b1b18[8S]} to {?}
     //
     // returnType = method_getTypeEncoding(class_getInstanceMethod([object class], selector));
-    NSMethodSignature *methodSignature = [object methodSignatureForSelector:selector];
     if (!methodSignature.methodReturnLength &&
         methodSignature.methodReturnType[0] != FLEXTypeEncodingVoid) {
         return nil;