[nginx] Core: expose maximum values of time_t and ngx_int_t.

Ruslan Ermilov ru at nginx.com
Tue Mar 17 09:59:36 UTC 2015


details:   http://hg.nginx.org/nginx/rev/b92d5a26d55f
branches:  
changeset: 6008:b92d5a26d55f
user:      Ruslan Ermilov <ru at nginx.com>
date:      Tue Mar 17 00:24:34 2015 +0300
description:
Core: expose maximum values of time_t and ngx_int_t.

These are needed to detect overflows.

diffstat:

 auto/unix                       |  1 +
 src/core/ngx_config.h           |  3 +++
 src/os/win32/ngx_win32_config.h |  2 ++
 3 files changed, 6 insertions(+), 0 deletions(-)

diffs (45 lines):

diff -r 79b473d5381d -r b92d5a26d55f auto/unix
--- a/auto/unix	Fri Mar 13 16:43:01 2015 +0300
+++ b/auto/unix	Tue Mar 17 00:24:34 2015 +0300
@@ -510,6 +510,7 @@ ngx_param=NGX_OFF_T_LEN; ngx_value=$ngx_
 ngx_type="time_t"; . auto/types/sizeof
 ngx_param=NGX_TIME_T_SIZE; ngx_value=$ngx_size; . auto/types/value
 ngx_param=NGX_TIME_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
+ngx_param=NGX_MAX_TIME_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
 
 
 # syscalls, libc calls and some features
diff -r 79b473d5381d -r b92d5a26d55f src/core/ngx_config.h
--- a/src/core/ngx_config.h	Fri Mar 13 16:43:01 2015 +0300
+++ b/src/core/ngx_config.h	Tue Mar 17 00:24:34 2015 +0300
@@ -85,8 +85,11 @@ typedef intptr_t        ngx_flag_t;
 
 #if (NGX_PTR_SIZE == 4)
 #define NGX_INT_T_LEN   NGX_INT32_LEN
+#define NGX_MAX_INT_T_VALUE  2147483647
+
 #else
 #define NGX_INT_T_LEN   NGX_INT64_LEN
+#define NGX_MAX_INT_T_VALUE  9223372036854775807
 #endif
 
 
diff -r 79b473d5381d -r b92d5a26d55f src/os/win32/ngx_win32_config.h
--- a/src/os/win32/ngx_win32_config.h	Fri Mar 13 16:43:01 2015 +0300
+++ b/src/os/win32/ngx_win32_config.h	Tue Mar 17 00:24:34 2015 +0300
@@ -196,6 +196,7 @@ typedef int                 sig_atomic_t
 #define NGX_MAX_SIZE_T_VALUE    9223372036854775807
 #define NGX_TIME_T_LEN          (sizeof("-9223372036854775808") - 1)
 #define NGX_TIME_T_SIZE         8
+#define NGX_MAX_TIME_T_VALUE    9223372036854775807
 
 #else
 
@@ -204,6 +205,7 @@ typedef int                 sig_atomic_t
 #define NGX_MAX_SIZE_T_VALUE    2147483647
 #define NGX_TIME_T_LEN          (sizeof("-2147483648") - 1)
 #define NGX_TIME_T_SIZE         4
+#define NGX_MAX_TIME_T_VALUE    2147483647
 
 #endif
 



More information about the nginx-devel mailing list