alibaba / xquic

XQUIC Library released by Alibaba is a cross-platform implementation of QUIC and HTTP/3 protocol.
Apache License 2.0
1.7k stars 327 forks source link

[Bug]: compute sampler->delivery_rate numerical transformation error #184

Closed adcen0107 closed 2 years ago

adcen0107 commented 2 years ago

What happened?

xqc_sample.c xqc_generate_sample()
if (sampler->interval != 0) { / unit of interval is us / sampler->delivery_rate = (uint64_t)(1e6 * sampler->delivered / sampler->interval); // error happened }

xqc_sample.h uint32_t delivery_rate;

Steps To Reproduce

这一句:sampler->delivery_rate = (uint64_t)(1e6 * sampler->delivered / sampler->interval);

sampler->delivery_rate是uint32_t,即赋值运算符左边是32位,右边是64位,有溢出风险。

Relevant log output

No response

ruiqizhou commented 2 years ago

We'd appreciate it if you could tell us what and how the error happened.

ruiqizhou commented 2 years ago

Hello, because there are no reproducible steps, we will close this issue. If necessary, reopen an issue and describe it in detail.