]> git.kaiwu.me - njs.git/commitdiff
Fixed integer-overflow in ToInt32().
authorDmitry Volyntsev <xeioex@nginx.com>
Mon, 24 May 2021 14:17:59 +0000 (14:17 +0000)
committerDmitry Volyntsev <xeioex@nginx.com>
Mon, 24 May 2021 14:17:59 +0000 (14:17 +0000)
error: negation of -2147483648 cannot be represented in type 'int32_t'.

Found by OSS-Fuzz.

src/njs_number.h

index b0f50dc4d8611a07239de94fda255455ddc64ab8..53800cdae3bd7969099349716d69dcfa3a0e3aee 100644 (file)
@@ -76,7 +76,7 @@ njs_number_to_integer(double num)
 njs_inline int32_t
 njs_number_to_int32(double num)
 {
-    int32_t           r;
+    uint32_t          r;
     uint64_t          v;
     njs_int_t         exp;
     njs_diyfp_conv_t  conv;