arecord is failing with -V stereo

folkert folkert at vanheusden.com
Mon Aug 23 19:03:32 CEST 2021


>         const int bar_length = 35;
>         char line[80];
...
>                 if (p > bar_length)
>                         p = bar_length;
>                 if (c)
>                         memset(line + bar_length + 6 + 1, '#', p);
> ----------------//this is the line where it is crashing.here p value is
> becoming negative at c=1.As we see if we change the p value to bar_length
> it works fine ..As it is a player issue not a driver issue.

This is puzzling.
bar_length + 6 + 1 + p and thus 35 + 6 + 1 + 35 is max 77, that fits
easlity in 80.

But wait:

                        line[bar_length - p - 1] = '+';

p is max bar_length, so we would end up putting '+' in line[-1]

Can you try this?


diff --git a/aplay/aplay.c b/aplay/aplay.c
index cc51dcb..9cfd52c 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -1764,7 +1764,7 @@ static void print_vu_meter_stereo(int *perc, int *maxperc)
 			p = bar_length;
 		if (c)
 			line[bar_length + 6 + 1 + p] = '+';
-		else
+		else if (p < bar_length)
 			line[bar_length - p - 1] = '+';
 		if (ABS(maxperc[c]) > 99)
 			sprintf(tmp, "MAX");


More information about the Alsa-devel mailing list