diff --git a/src/buffer.cpp b/src/buffer.cpp index c937aa1000..8b39512791 100644 --- a/src/buffer.cpp +++ b/src/buffer.cpp @@ -146,7 +146,8 @@ bool CNetBuf::Put ( const CVector& vecbyData, int iInSize ) const int iNumBlocks = /* floor */ ( iInSize / iBlockSize ); // copy new data in internal buffer - for ( int iBlock = 0; iBlock < iNumBlocks; iBlock++ ) + // iBlock is a long to avoid overflowing a mulitplication later in the code + for ( long iBlock = 0; iBlock < iNumBlocks; iBlock++ ) { // extract sequence number of current received block (per definition // the sequence number is appended after the coded audio data) @@ -263,7 +264,8 @@ bool CNetBuf::Put ( const CVector& vecbyData, int iInSize ) // copy new data in internal buffer const int iNumBlocks = iInSize / iBlockSize; - for ( int iBlock = 0; iBlock < iNumBlocks; iBlock++ ) + // iBlock is a long to avoid overflowing a mulitplication later in the code + for ( long iBlock = 0; iBlock < iNumBlocks; iBlock++ ) { // for simultion buffer only update pointer, no data copying if ( !bIsSimulation )