[njs] Fixed integer-overflow in ToInt32().

Dmitry Volyntsev xeioex at nginx.com
Mon May 24 14:18:47 UTC 2021


details:   https://hg.nginx.org/njs/rev/a33a16ec5aa0
branches:  
changeset: 1642:a33a16ec5aa0
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Mon May 24 14:17:59 2021 +0000
description:
Fixed integer-overflow in ToInt32().

error: negation of -2147483648 cannot be represented in type 'int32_t'.

Found by OSS-Fuzz.

diffstat:

 src/njs_number.h |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 98f436565ddf -r a33a16ec5aa0 src/njs_number.h
--- a/src/njs_number.h	Mon May 24 12:33:43 2021 +0000
+++ b/src/njs_number.h	Mon May 24 14:17:59 2021 +0000
@@ -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;


More information about the nginx-devel mailing list