diff options
author | Craig Tiller <ctiller@google.com> | 2017-07-11 13:55:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-11 13:55:18 -0700 |
commit | 7593255314aa08029c9a59cad432786b10840e61 (patch) | |
tree | 0daf4c55737d43ebc336d8eb3e2d87baf73bbe96 /src/core/ext/transport | |
parent | 809fbfdc03e484f81887f88fdddc0289ba3fab49 (diff) | |
parent | 8af79897180b324ad68ed96f7c633ab8ef34d43d (diff) |
Merge pull request #11702 from ctiller/ubsan101
Fix potential rounding error
Diffstat (limited to 'src/core/ext/transport')
-rw-r--r-- | src/core/ext/transport/chttp2/transport/chttp2_transport.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 9157170f52..d05aa00a3e 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2152,8 +2152,8 @@ static void update_bdp(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, static void update_frame(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, double bw_dbl, double bdp_dbl) { - int32_t bdp = GPR_CLAMP((int32_t)bdp_dbl, 128, INT32_MAX); - int32_t target = GPR_MAX((int32_t)bw_dbl / 1000, bdp); + int32_t bdp = (int32_t)GPR_CLAMP(bdp_dbl, 128.0, INT32_MAX); + int32_t target = (int32_t)GPR_MAX(bw_dbl / 1000, bdp); // frame size is bounded [2^14,2^24-1] int32_t frame_size = GPR_CLAMP(target, 16384, 16777215); int64_t delta = (int64_t)frame_size - |