Skip to content

Commit

Permalink
Fixed a division by zero crash when playing mono VOC files
Browse files Browse the repository at this point in the history
  • Loading branch information
Wohlstand committed Mar 24, 2020
1 parent f47b162 commit e8198d6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/codecs/load_voc.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ static int voc_get_block(SDL_RWops *src, vs_t *v, SDL_AudioSpec *spec)
if (SDL_RWread(src, &uc, sizeof (uc), 1) != 1)
return 0;

if (uc)
spec->channels = 2; /* Stereo */
spec->channels = uc ? 2 /* Stereo */: 1; /* Mono */

/* Needed number of channels before finishing
compute for rate */
spec->freq = (256000000L/(65536L - v->rate))/spec->channels;
Expand Down

0 comments on commit e8198d6

Please sign in to comment.