]> git.saurik.com Git - cycript.git/commitdiff
Try to CYON pointers as the address of their value.
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 20 Jan 2014 10:29:23 +0000 (02:29 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 20 Jan 2014 10:29:23 +0000 (02:29 -0800)
Execute.cpp

index 1c8983cc6918130e9cd8fb3c8e12a7e5214587ce..61acaf2e8a05f36ca1c3b6114bae8d1c0ab594c5 100644 (file)
@@ -1248,13 +1248,18 @@ static JSValueRef Pointer_callAsFunction_toCYON(JSContextRef context, JSObjectRe
         JSObjectRef Array(CYGetCachedObject(context, CYJSString("Array_prototype")));
         JSObjectRef toCYON(CYCastJSObject(context, CYGetProperty(context, Array, toCYON_s)));
         return CYCallAsFunction(context, toCYON, _this, count, arguments);
-    } else try {
-        CYPool pool;
-        return CYCastJSValue(context, pool.strcat("&", CYPoolCCYON(pool, context, CYGetProperty(context, _this, cyi_s)), NULL));
-    } catch (const CYException &e) {
+    } else if (internal->type_->type_ == NULL) pointer: {
         char string[32];
         sprintf(string, "%p", internal->value_);
         return CYCastJSValue(context, string);
+    } try {
+        JSValueRef value(CYGetProperty(context, _this, cyi_s));
+        if (JSValueIsUndefined(context, value))
+            goto pointer;
+        CYPool pool;
+        return CYCastJSValue(context, pool.strcat("&", CYPoolCCYON(pool, context, value), NULL));
+    } catch (const CYException &e) {
+        goto pointer;
     }
 } CYCatch(NULL) }