Opened 8 years ago

Closed 7 years ago

#1072 closed defect (fixed)

Overflow in ngx_atosz with Visual Studio 2013 in 64bit system

Reported by: ansarhun@… Owned by:
Priority: minor Milestone:
Component: other Version: 1.8.x
Keywords: Cc:
uname -a:
nginx -V: nginx version: nginx/1.8.1
built with OpenSSL 1.0.2a 19 Mar 2015
TLS SNI support enabled
configure arguments:CMakeLists.txt


When I was trying to set Content-Length header from lua, I got an error that setting the header failed.

The error occured in


, when it tried to parse the data with



The ssize_t is defined as int which is 32bit in visual studio.
When setting the NGX_MAX_SIZE_T_VALUE value to a ssize_t variable it overflows, and checks fail with cutoff:

if (value >= cutoff && (value > cutoff || *line - '0' > cutlim)) {

Changing the define in ngx_win32_config.h to


solves the problem.

typedef __int64                 ssize_t;

Change History (1)

comment:1 by Maxim Dounin, 7 years ago

Resolution: fixed
Status: newclosed

Basic support of 64-bit compilation with MSVC was added in e4590dfd97ff.

Note: See TracTickets for help on using tickets.