diff options
author | Sergey Kandaurov <pluknet@nginx.com> | 2016-07-07 21:02:28 +0300 |
---|---|---|
committer | Sergey Kandaurov <pluknet@nginx.com> | 2016-07-07 21:02:28 +0300 |
commit | 6299f5e9149483251bbbcc8ad26cf29b6109e75c (patch) | |
tree | 43339ffe7b9e30b4865f13176be7588ce1378a30 /src/http/modules/ngx_http_log_module.c | |
parent | 678991a8f6b4eff4c7e5a5ee308378c2f1e327b7 (diff) | |
download | nginx-6299f5e9149483251bbbcc8ad26cf29b6109e75c.tar.gz nginx-6299f5e9149483251bbbcc8ad26cf29b6109e75c.zip |
Avoid left-shifting integers into the sign bit, which is undefined.
Found with UndefinedBehaviorSanitizer.
Diffstat (limited to 'src/http/modules/ngx_http_log_module.c')
-rw-r--r-- | src/http/modules/ngx_http_log_module.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/http/modules/ngx_http_log_module.c b/src/http/modules/ngx_http_log_module.c index df9424f83..c42fb08ed 100644 --- a/src/http/modules/ngx_http_log_module.c +++ b/src/http/modules/ngx_http_log_module.c @@ -1000,7 +1000,7 @@ ngx_http_log_escape(u_char *dst, u_char *src, size_t size) n = 0; while (size) { - if (escape[*src >> 5] & (1 << (*src & 0x1f))) { + if (escape[*src >> 5] & (1U << (*src & 0x1f))) { n++; } src++; @@ -1011,7 +1011,7 @@ ngx_http_log_escape(u_char *dst, u_char *src, size_t size) } while (size) { - if (escape[*src >> 5] & (1 << (*src & 0x1f))) { + if (escape[*src >> 5] & (1U << (*src & 0x1f))) { *dst++ = '\\'; *dst++ = 'x'; *dst++ = hex[*src >> 4]; |