Skip to content

Commit

Permalink
ALSA: synth: emux: soundfont.c: divide by zero in calc_gus_envelope_t…
Browse files Browse the repository at this point in the history
…ime()

This function is called from load_guspatch() and the rate is specified
by the user.  If they accidentally selected zero then it would crash the
kernel.  I've just changed the zero to a one.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Dan Carpenter authored and Takashi Iwai committed May 6, 2019
1 parent 17b89c8 commit 2854cd3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sound/synth/emux/soundfont.c
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,8 @@ calc_gus_envelope_time(int rate, int start, int end)
int r, p, t;
r = (3 - ((rate >> 6) & 3)) * 3;
p = rate & 0x3f;
if (!p)
p = 1;
t = end - start;
if (t < 0) t = -t;
if (13 > r)
Expand Down

0 comments on commit 2854cd3

Please sign in to comment.