]> git.saurik.com Git - cycript.git/commitdiff
Do not allow loss of precision due to double cast.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 20 Dec 2015 10:12:35 +0000 (02:12 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 20 Dec 2015 10:12:35 +0000 (02:12 -0800)
Execute.cpp

index 340a7fa876fdc12b78155d6f6a92ae4c1062401e..2e02b28f818026ae123e2ceada161cbdae2157e7 100644 (file)
@@ -297,6 +297,7 @@ JSValueRef CYCastJSValue(JSContextRef context, double value) {
 
 #define CYCastJSValue_(Type_) \
     JSValueRef CYCastJSValue(JSContextRef context, Type_ value) { \
 
 #define CYCastJSValue_(Type_) \
     JSValueRef CYCastJSValue(JSContextRef context, Type_ value) { \
+        _assert(static_cast<Type_>(static_cast<double>(value)) == value); \
         return JSValueMakeNumber(context, static_cast<double>(value)); \
     }
 
         return JSValueMakeNumber(context, static_cast<double>(value)); \
     }