1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-25 00:30:07 +02:00

Assert that sampleCount doesn't narrow converting to 3d party types

This commit is contained in:
Paul Licameli 2016-08-29 08:50:11 -04:00
parent 26b5e77050
commit 99dca62cff
4 changed files with 15 additions and 1 deletions

View File

@ -528,6 +528,9 @@ int ODPCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format,
mSilentAliasLog=FALSE; mSilentAliasLog=FALSE;
// Third party library has its own type alias, check it
static_assert(sizeof(sampleCount::type) <= sizeof(sf_count_t),
"Type sf_count_t is too narrow to hold a sampleCount");
SFCall<sf_count_t>(sf_seek, sf.get(), mAliasStart + start, SEEK_SET); SFCall<sf_count_t>(sf_seek, sf.get(), mAliasStart + start, SEEK_SET);
wxASSERT(info.channels >= 0); wxASSERT(info.channels >= 0);

View File

@ -116,6 +116,9 @@ int PCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format,
} }
mSilentAliasLog=FALSE; mSilentAliasLog=FALSE;
// Third party library has its own type alias, check it
static_assert(sizeof(sampleCount::type) <= sizeof(sf_count_t),
"Type sf_count_t is too narrow to hold a sampleCount");
SFCall<sf_count_t>(sf_seek, sf.get(), mAliasStart + start, SEEK_SET); SFCall<sf_count_t>(sf_seek, sf.get(), mAliasStart + start, SEEK_SET);
wxASSERT(info.channels >= 0); wxASSERT(info.channels >= 0);
SampleBuffer buffer(len * info.channels, floatSample); SampleBuffer buffer(len * info.channels, floatSample);

View File

@ -306,6 +306,10 @@ bool EffectSBSMS::Process()
outResampleCB = resampleCB; outResampleCB = resampleCB;
rb.offset = start; rb.offset = start;
rb.end = end; rb.end = end;
// Third party library has its own type alias, check it
static_assert(sizeof(sampleCount::type) <=
sizeof(_sbsms_::SampleCountType),
"Type _sbsms_::SampleCountType is too narrow to hold a sampleCount");
rb.iface = std::make_unique<SBSMSInterfaceSliding>(&rateSlide,&pitchSlide, rb.iface = std::make_unique<SBSMSInterfaceSliding>(&rateSlide,&pitchSlide,
bPitchReferenceInput, bPitchReferenceInput,
samplesToProcess,0, samplesToProcess,0,

View File

@ -190,6 +190,10 @@ int ODFlacDecoder::Decode(SampleBuffer & data, sampleFormat & format, sampleCoun
mTargetChannel=channel; mTargetChannel=channel;
// Third party library has its own type alias, check it
static_assert(sizeof(sampleCount::type) <=
sizeof(FLAC__int64),
"Type FLAC__int64 is too narrow to hold a sampleCount");
if(!mFile->seek_absolute(start)) if(!mFile->seek_absolute(start))
{ {
mFlacFileLock.Unlock(); mFlacFileLock.Unlock();