]> git.saurik.com Git - cycript.git/commitdiff
Fix issue in 64-bit choose() reported by heardrwt.
authorJay Freeman (saurik) <saurik@saurik.com>
Tue, 3 Jun 2014 22:32:07 +0000 (15:32 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Tue, 3 Jun 2014 22:32:07 +0000 (15:32 -0700)
ObjectiveC/Library.mm

index b7d23efc742fd201932e3b32773279a53d1b6e60..a685816ecbb22f3d3c30d86494575f019da97150 100644 (file)
@@ -2334,7 +2334,12 @@ static void choose_(task_t task, void *baton, unsigned type, vm_range_t *ranges,
 
         size_t needed(class_getInstanceSize(*result));
         // XXX: if (size < needed)
-        if (needed <= 496 && (needed + 15) / 16 * 16 != size || needed > 496 && (needed + 511) / 512 * 512 != size)
+
+        size_t boundary(496);
+#ifdef __LP64__
+        boundary *= 2;
+#endif
+        if (needed <= boundary && (needed + 15) / 16 * 16 != size || needed > boundary && (needed + 511) / 512 * 512 != size)
             continue;
         CYArrayPush(context, choice->results_, CYCastJSValue(context, reinterpret_cast<id>(data)));
     }