diff options
author | Chris Robinson <[email protected]> | 2014-05-20 09:16:54 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-05-20 09:16:54 -0700 |
commit | f313ce2a96af4432dd311c2c86343b24f7b555eb (patch) | |
tree | 8672f4502ebc2b3c7d06340c7e65efcf77ae1364 /OpenAL32/sample_cvt.c | |
parent | cd983245f1967e04f833acc0ec27aefa94f061b0 (diff) |
Add some asserts to verify block alignment for conversion
Diffstat (limited to 'OpenAL32/sample_cvt.c')
-rw-r--r-- | OpenAL32/sample_cvt.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/OpenAL32/sample_cvt.c b/OpenAL32/sample_cvt.c index 7ea4180e..a02b217e 100644 --- a/OpenAL32/sample_cvt.c +++ b/OpenAL32/sample_cvt.c @@ -920,6 +920,7 @@ static void Convert_##T##_ALima4(T *dst, const ALima4 *src, ALuint numchans, \ DECL_VLA(ALshort, tmp, align*numchans); \ ALuint i, j, k; \ \ + assert(align > 0 && (len%align) == 0); \ for(i = 0;i < len;i += align) \ { \ DecodeIMA4Block(tmp, src, numchans, align); \ @@ -941,6 +942,7 @@ static void Convert_ALshort_ALima4(ALshort *dst, const ALima4 *src, ALuint numch ALsizei byte_align = ((align-1)/2 + 4) * numchans; ALuint i; + assert(align > 0 && (len%align) == 0); for(i = 0;i < len;i += align) { DecodeIMA4Block(dst, src, numchans, align); @@ -970,6 +972,7 @@ static void Convert_ALima4_##T(ALima4 *dst, const T *src, ALuint numchans, \ DECL_VLA(ALshort, tmp, align*numchans); \ ALuint i, j, k; \ \ + assert(align > 0 && (len%align) == 0); \ for(i = 0;i < len;i += align) \ { \ for(j = 0;j < align;j++) \ @@ -992,6 +995,7 @@ static void Convert_ALima4_ALshort(ALima4 *dst, const ALshort *src, ALsizei byte_align = ((align-1)/2 + 4) * numchans; ALuint i; + assert(align > 0 && (len%align) == 0); for(i = 0;i < len;i += align) { EncodeIMA4Block(dst, src, sample, index, numchans, align); @@ -1021,6 +1025,7 @@ static void Convert_##T##_ALmsadpcm(T *dst, const ALmsadpcm *src, \ DECL_VLA(ALshort, tmp, align*numchans); \ ALuint i, j, k; \ \ + assert(align > 1 && (len%align) == 0); \ for(i = 0;i < len;i += align) \ { \ DecodeMSADPCMBlock(tmp, src, numchans, align); \ @@ -1043,6 +1048,7 @@ static void Convert_ALshort_ALmsadpcm(ALshort *dst, const ALmsadpcm *src, ALsizei byte_align = ((align-2)/2 + 7) * numchans; ALuint i; + assert(align > 1 && (len%align) == 0); for(i = 0;i < len;i += align) { DecodeMSADPCMBlock(dst, src, numchans, align); @@ -1071,6 +1077,7 @@ static void Convert_ALmsadpcm_##T(ALmsadpcm *dst, const T *src, \ DECL_VLA(ALshort, tmp, align*numchans); \ ALuint i, j, k; \ \ + assert(align > 1 && (len%align) == 0); \ for(i = 0;i < len;i += align) \ { \ for(j = 0;j < align;j++) \ @@ -1092,6 +1099,7 @@ static void Convert_ALmsadpcm_ALshort(ALmsadpcm *dst, const ALshort *src, ALsizei byte_align = ((align-2)/2 + 7) * numchans; ALuint i; + assert(align > 1 && (len%align) == 0); for(i = 0;i < len;i += align) { EncodeMSADPCMBlock(dst, src, sample, numchans, align); |