Skip to content

Commit 6965d05

Browse files
committed
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 <#995>
1 parent 71df317 commit 6965d05

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/src/cli.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,9 @@ parse_integer_arg(const char *s, long *out, bool accept_suffix, long min,
224224
static bool
225225
parse_bit_rate(const char *s, uint32_t *bit_rate) {
226226
long value;
227-
bool ok = parse_integer_arg(s, &value, true, 0, 0xFFFFFFFF, "bit-rate");
227+
// long may be 32 bits (it is the case on mingw), so do not use more than
228+
// 31 bits (long is signed)
229+
bool ok = parse_integer_arg(s, &value, true, 0, 0x7FFFFFFF, "bit-rate");
228230
if (!ok) {
229231
return false;
230232
}

0 commit comments

Comments
 (0)