mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Fix audio file length misscalculated due to overflow.
`s_info->samples' is very big, even for short wave files. Multiply it by 1000 has a very high chance of flowing over and it is a wonder that so far no one noticed it. Fix the overflow by working on 64 bit integers. Closes #931.
This commit is contained in:
parent
8b12b017f7
commit
a1e0ce0732
1 changed files with 3 additions and 1 deletions
|
@ -34,6 +34,8 @@
|
|||
|
||||
#ifdef USE_OPENAL
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../header/client.h"
|
||||
#include "header/local.h"
|
||||
#include "header/qal.h"
|
||||
|
@ -206,7 +208,7 @@ AL_UploadSfx(sfx_t *s, wavinfo_t *s_info, byte *data, short volume,
|
|||
|
||||
/* allocate placeholder sfxcache */
|
||||
sc = s->cache = Z_TagMalloc(sizeof(*sc), 0);
|
||||
sc->length = s_info->samples * 1000 / s_info->rate;
|
||||
sc->length = ((uint64_t)s_info->samples * 1000) / s_info->rate;
|
||||
sc->loopstart = s_info->loopstart;
|
||||
sc->width = s_info->width;
|
||||
sc->size = size;
|
||||
|
|
Loading…
Reference in a new issue