mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-27 15:10:53 +00:00
3f08120ac1
* Fix 2 UB and 4 portability bugs in quickjs
30 lines
894 B
Diff
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;
|