Skip to content

Commit 376765c

Browse files
Fix integer overflow issue.
1 parent 573abb9 commit 376765c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

AudioFile.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ bool AudioFile<T>::decodeWaveFile (const std::vector<uint8_t>& fileData)
652652
{
653653
for (int channel = 0; channel < numChannels; channel++)
654654
{
655-
int sampleIndex = samplesStartIndex + (numBytesPerBlock * i) + channel * numBytesPerSample;
655+
size_t sampleIndex = samplesStartIndex + (numBytesPerBlock * i) + channel * numBytesPerSample;
656656

657657
if ((sampleIndex + (bitDepth / 8) - 1) >= fileData.size())
658658
{
@@ -813,7 +813,7 @@ bool AudioFile<T>::decodeAiffFile (const std::vector<uint8_t>& fileData)
813813
{
814814
for (int channel = 0; channel < numChannels; channel++)
815815
{
816-
int sampleIndex = samplesStartIndex + (numBytesPerFrame * i) + channel * numBytesPerSample;
816+
size_t sampleIndex = samplesStartIndex + (numBytesPerFrame * i) + channel * numBytesPerSample;
817817

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

0 commit comments

Comments
 (0)