radare2/shlr/qjs/double.patch
pancake 3f08120ac1
Import the quickjs rlang plugin ##lang
* Fix 2 UB and 4 portability bugs in quickjs
2022-12-10 18:58:33 +01:00

30 lines
894 B
Diff

diff --git a/shlr/qjs/src/quickjs.c b/shlr/qjs/src/quickjs.c
index a8e8ae96fd..4585067f94 100644
--- a/shlr/qjs/src/quickjs.c
+++ b/shlr/qjs/src/quickjs.c
@@ -67,10 +67,12 @@
#define MALLOC_OVERHEAD 8
#endif
+#if 0
#if !defined(_WIN32)
/* define it if printf uses the RNDN rounding mode instead of RNDNA */
#define CONFIG_PRINTF_RNDN
#endif
+#endif
/* dump object free */
//#define DUMP_FREE
@@ -10913,9 +10915,9 @@ static int JS_ToInt64SatFree(JSContext *ctx, int64_t *pres, JSValue val)
if (isnan(d)) {
*pres = 0;
} else {
- if (d < INT64_MIN)
+ if (d < (double)INT64_MIN)
*pres = INT64_MIN;
- else if (d > INT64_MAX)
+ else if (d > (double)INT64_MAX)
*pres = INT64_MAX;
else
*pres = (int64_t)d;