Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Kandaurov <pluknet@nginx.com>2016-07-07 21:02:28 +0300
committerSergey Kandaurov <pluknet@nginx.com>2016-07-07 21:02:28 +0300
commit6299f5e9149483251bbbcc8ad26cf29b6109e75c (patch)
tree43339ffe7b9e30b4865f13176be7588ce1378a30 /src/core/ngx_string.c
parent678991a8f6b4eff4c7e5a5ee308378c2f1e327b7 (diff)
Avoid left-shifting integers into the sign bit, which is undefined.
Found with UndefinedBehaviorSanitizer.
Diffstat (limited to 'src/core/ngx_string.c')
-rw-r--r--src/core/ngx_string.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c
index cf665a4e8..7a73ef527 100644
--- a/src/core/ngx_string.c
+++ b/src/core/ngx_string.c
@@ -1563,7 +1563,7 @@ ngx_escape_uri(u_char *dst, u_char *src, size_t size, ngx_uint_t type)
n = 0;
while (size) {
- if (escape[*src >> 5] & (1 << (*src & 0x1f))) {
+ if (escape[*src >> 5] & (1U << (*src & 0x1f))) {
n++;
}
src++;
@@ -1574,7 +1574,7 @@ ngx_escape_uri(u_char *dst, u_char *src, size_t size, ngx_uint_t type)
}
while (size) {
- if (escape[*src >> 5] & (1 << (*src & 0x1f))) {
+ if (escape[*src >> 5] & (1U << (*src & 0x1f))) {
*dst++ = '%';
*dst++ = hex[*src >> 4];
*dst++ = hex[*src & 0xf];