mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 00:25:43 +01:00
aplay: Fix out-of-bound access in stereo VU meter drawing
The left channel drawing of a stereo VU meter has a bug where it may access a negative array index. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
2efe124c31
commit
dea51861a8
1 changed files with 6 additions and 4 deletions
|
@ -1758,10 +1758,12 @@ static void print_vu_meter_stereo(int *perc, int *maxperc)
|
||||||
if (c)
|
if (c)
|
||||||
memset(line + bar_length + 6 + 1, '#', p);
|
memset(line + bar_length + 6 + 1, '#', p);
|
||||||
else
|
else
|
||||||
memset(line + bar_length - p - 1, '#', p);
|
memset(line + bar_length - p, '#', p);
|
||||||
p = maxperc[c] * bar_length / 100;
|
p = maxperc[c] * bar_length / 100 - 1;
|
||||||
if (p > bar_length)
|
if (p < 0)
|
||||||
p = bar_length;
|
p = 0;
|
||||||
|
else if (p >= bar_length)
|
||||||
|
p = bar_length - 1;
|
||||||
if (c)
|
if (c)
|
||||||
line[bar_length + 6 + 1 + p] = '+';
|
line[bar_length + 6 + 1 + p] = '+';
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue