misc.c format_sound_value guard division by zero
Change-Id: I7085cb34d2258aa5fc7e04fc0e73d6f733810038
This commit is contained in:
parent
848633f921
commit
d57900ae12
1 changed files with 5 additions and 0 deletions
|
@ -1049,6 +1049,11 @@ int format_sound_value(char *buf, size_t size, int snd, int val)
|
|||
int physval = sound_val2phys(snd, val);
|
||||
|
||||
unsigned int factor = ipow(10, numdec);
|
||||
if (factor == 0)
|
||||
{
|
||||
DEBUGF("DIVISION BY ZERO: format_sound_value s:%d v:%d", snd, val);
|
||||
factor = 1;
|
||||
}
|
||||
unsigned int av = abs(physval);
|
||||
unsigned int i = av / factor;
|
||||
unsigned int d = av - i*factor;
|
||||
|
|
Loading…
Reference in a new issue