comparison src/http/modules/ngx_http_userid_filter_module.c @ 6626:b3682580c1bd

Avoid left-shifting integers into the sign bit, which is undefined. Found with UndefinedBehaviorSanitizer.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 07 Jul 2016 21:02:28 +0300
parents 778ef9c3fd2d
children e6f399a176e7
comparison
equal deleted inserted replaced
6625:a616bdc38645 6626:b3682580c1bd
834 struct timeval tp; 834 struct timeval tp;
835 835
836 ngx_gettimeofday(&tp); 836 ngx_gettimeofday(&tp);
837 837
838 /* use the most significant usec part that fits to 16 bits */ 838 /* use the most significant usec part that fits to 16 bits */
839 start_value = ((tp.tv_usec / 20) << 16) | ngx_pid; 839 start_value = (((uint32_t) tp.tv_usec / 20) << 16) | ngx_pid;
840 840
841 return NGX_OK; 841 return NGX_OK;
842 } 842 }