Mercurial > hg > nginx
comparison src/http/modules/ngx_http_grpc_module.c @ 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 | 25a4353633a0 |
children | 9e25a5380a21 6afba58cd5a3 |
comparison
equal
deleted
inserted
replaced
7248:fdd6a070d518 | 7249:070c972336c4 |
---|---|
3210 #endif | 3210 #endif |
3211 | 3211 |
3212 switch (state) { | 3212 switch (state) { |
3213 | 3213 |
3214 case sw_start: | 3214 case sw_start: |
3215 ctx->error = ch << 24; | 3215 ctx->error = (ngx_uint_t) ch << 24; |
3216 state = sw_error_2; | 3216 state = sw_error_2; |
3217 break; | 3217 break; |
3218 | 3218 |
3219 case sw_error_2: | 3219 case sw_error_2: |
3220 ctx->error |= ch << 16; | 3220 ctx->error |= ch << 16; |
3323 ctx->stream_id |= ch; | 3323 ctx->stream_id |= ch; |
3324 state = sw_error; | 3324 state = sw_error; |
3325 break; | 3325 break; |
3326 | 3326 |
3327 case sw_error: | 3327 case sw_error: |
3328 ctx->error = ch << 24; | 3328 ctx->error = (ngx_uint_t) ch << 24; |
3329 state = sw_error_2; | 3329 state = sw_error_2; |
3330 break; | 3330 break; |
3331 | 3331 |
3332 case sw_error_2: | 3332 case sw_error_2: |
3333 ctx->error |= ch << 16; | 3333 ctx->error |= ch << 16; |
3553 ctx->setting_id |= ch; | 3553 ctx->setting_id |= ch; |
3554 state = sw_value; | 3554 state = sw_value; |
3555 break; | 3555 break; |
3556 | 3556 |
3557 case sw_value: | 3557 case sw_value: |
3558 ctx->setting_value = ch << 24; | 3558 ctx->setting_value = (ngx_uint_t) ch << 24; |
3559 state = sw_value_2; | 3559 state = sw_value_2; |
3560 break; | 3560 break; |
3561 | 3561 |
3562 case sw_value_2: | 3562 case sw_value_2: |
3563 ctx->setting_value |= ch << 16; | 3563 ctx->setting_value |= ch << 16; |