changeset 7249:070c972336c4

gRPC: fixed possible sign extension of error and setting_value. All cases are harmless and should not happen on valid values, though can result in bad values being shown incorrectly in logs. Found by Coverity (CID 1430311, 1430312, 1430313).
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 22 Mar 2018 19:26:25 +0300
parents fdd6a070d518
children ec4d95eed062
files src/http/modules/ngx_http_grpc_module.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/modules/ngx_http_grpc_module.c	Thu Mar 22 18:13:33 2018 +0300
+++ b/src/http/modules/ngx_http_grpc_module.c	Thu Mar 22 19:26:25 2018 +0300
@@ -3212,7 +3212,7 @@
         switch (state) {
 
         case sw_start:
-            ctx->error = ch << 24;
+            ctx->error = (ngx_uint_t) ch << 24;
             state = sw_error_2;
             break;
 
@@ -3325,7 +3325,7 @@
             break;
 
         case sw_error:
-            ctx->error = ch << 24;
+            ctx->error = (ngx_uint_t) ch << 24;
             state = sw_error_2;
             break;
 
@@ -3555,7 +3555,7 @@
             break;
 
         case sw_value:
-            ctx->setting_value = ch << 24;
+            ctx->setting_value = (ngx_uint_t) ch << 24;
             state = sw_value_2;
             break;