[nginx] Fixed undefined behavior when left shifting signed integer.

Ruslan Ermilov ru at nginx.com
Mon Aug 8 08:18:27 UTC 2016


details:   http://hg.nginx.org/nginx/rev/1a1d55834b5c
branches:  
changeset: 6650:1a1d55834b5c
user:      Ruslan Ermilov <ru at nginx.com>
date:      Thu Aug 04 23:42:00 2016 +0300
description:
Fixed undefined behavior when left shifting signed integer.

diffstat:

 src/os/unix/ngx_process_cycle.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 09c918460cc6 -r 1a1d55834b5c src/os/unix/ngx_process_cycle.c
--- a/src/os/unix/ngx_process_cycle.c	Thu Aug 04 01:15:41 2016 +0300
+++ b/src/os/unix/ngx_process_cycle.c	Thu Aug 04 23:42:00 2016 +0300
@@ -884,7 +884,7 @@ ngx_worker_process_init(ngx_cycle_t *cyc
                       "sigprocmask() failed");
     }
 
-    srandom((ngx_pid << 16) ^ ngx_time());
+    srandom(((unsigned) ngx_pid << 16) ^ ngx_time());
 
     /*
      * disable deleting previous events for the listening sockets because



More information about the nginx-devel mailing list