mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-08 14:48:25 +01:00
aplay: Don't pass most negative integer to abs() in peak calculations
The return value from abs() for the most negative integer is undefined. Cap it properly for the 32bit sample handling. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
5c4bf63a94
commit
d9b3133815
1 changed files with 4 additions and 1 deletions
|
@ -1874,6 +1874,9 @@ static void compute_max_peak(u_char *data, size_t samples)
|
|||
else
|
||||
val = be32toh(*valp);
|
||||
val ^= mask;
|
||||
if (val == 0x80000000U)
|
||||
val = 0x7fffffff;
|
||||
else
|
||||
val = abs(val);
|
||||
if (max_peak[c] < val)
|
||||
max_peak[c] = val;
|
||||
|
|
Loading…
Reference in a new issue