Skip to content

Commit ee1a08e

Browse files
authored
Merge pull request #99 from zhouchanglin-rr/master
Fix integer overflow issue.
2 parents 782f70b + 376765c commit ee1a08e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

AudioFile.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ bool AudioFile<T>::decodeWaveFile (const std::vector<uint8_t>& fileData)
636636
{
637637
for (int channel = 0; channel < numChannels; channel++)
638638
{
639-
int sampleIndex = samplesStartIndex + (numBytesPerBlock * i) + channel * numBytesPerSample;
639+
size_t sampleIndex = samplesStartIndex + (numBytesPerBlock * i) + channel * numBytesPerSample;
640640

641641
if ((sampleIndex + (bitDepth / 8) - 1) >= fileData.size())
642642
{
@@ -797,7 +797,7 @@ bool AudioFile<T>::decodeAiffFile (const std::vector<uint8_t>& fileData)
797797
{
798798
for (int channel = 0; channel < numChannels; channel++)
799799
{
800-
int sampleIndex = samplesStartIndex + (numBytesPerFrame * i) + channel * numBytesPerSample;
800+
size_t sampleIndex = samplesStartIndex + (numBytesPerFrame * i) + channel * numBytesPerSample;
801801

802802
if ((sampleIndex + (bitDepth / 8) - 1) >= fileData.size())
803803
{

0 commit comments

Comments
 (0)