提交 6965d051 编写于 作者: R Romain Vimont

Limit bitrate range to 31 bits integer

A proper solution could be to use "long long" instead (guaranteed to be
at least 64 bits), but it adds its own problems (e.g. "%lld" is not
supported as a printf format on all platforms).

In practice, we don't need such high values, so keep it simple.

Fixes #995 <https://github.com/Genymobile/scrcpy/issues/995>
上级 71df3175
...@@ -224,7 +224,9 @@ parse_integer_arg(const char *s, long *out, bool accept_suffix, long min, ...@@ -224,7 +224,9 @@ parse_integer_arg(const char *s, long *out, bool accept_suffix, long min,
static bool static bool
parse_bit_rate(const char *s, uint32_t *bit_rate) { parse_bit_rate(const char *s, uint32_t *bit_rate) {
long value; long value;
bool ok = parse_integer_arg(s, &value, true, 0, 0xFFFFFFFF, "bit-rate"); // long may be 32 bits (it is the case on mingw), so do not use more than
// 31 bits (long is signed)
bool ok = parse_integer_arg(s, &value, true, 0, 0x7FFFFFFF, "bit-rate");
if (!ok) { if (!ok) {
return false; return false;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册