summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-08-03 22:41:04 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2021-08-05 11:00:47 +0000
commitd57900ae124d4b5553db6666959a6533d9e337b5 (patch)
tree85acec47d3000445c692e7431f10ec0f07bc3c1e /apps
parent848633f921e85b6b298b1c949c17aea56b0af86a (diff)
downloadrockbox-d57900ae124d4b5553db6666959a6533d9e337b5.tar.gz
rockbox-d57900ae124d4b5553db6666959a6533d9e337b5.zip
misc.c format_sound_value guard division by zero
Change-Id: I7085cb34d2258aa5fc7e04fc0e73d6f733810038
Diffstat (limited to 'apps')
-rw-r--r--apps/misc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/misc.c b/apps/misc.c
index 96ad534c68..293154c942 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -1049,6 +1049,11 @@ int format_sound_value(char *buf, size_t size, int snd, int val)
1049 int physval = sound_val2phys(snd, val); 1049 int physval = sound_val2phys(snd, val);
1050 1050
1051 unsigned int factor = ipow(10, numdec); 1051 unsigned int factor = ipow(10, numdec);
1052 if (factor == 0)
1053 {
1054 DEBUGF("DIVISION BY ZERO: format_sound_value s:%d v:%d", snd, val);
1055 factor = 1;
1056 }
1052 unsigned int av = abs(physval); 1057 unsigned int av = abs(physval);
1053 unsigned int i = av / factor; 1058 unsigned int i = av / factor;
1054 unsigned int d = av - i*factor; 1059 unsigned int d = av - i*factor;