mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
AudioFormatReader: Add early return when numSamples <= 0 to prevent potential crashes
This commit is contained in:
parent
f49ab1d50e
commit
de78cd0c06
4 changed files with 12 additions and 0 deletions
|
|
@ -834,6 +834,9 @@ public:
|
|||
clearSamplesBeyondAvailableLength (destSamples, numDestChannels, startOffsetInDestBuffer,
|
||||
startSampleInFile, numSamples, lengthInSamples);
|
||||
|
||||
if (numSamples <= 0)
|
||||
return true;
|
||||
|
||||
if (map == nullptr || ! mappedSection.contains (Range<int64> (startSampleInFile, startSampleInFile + numSamples)))
|
||||
{
|
||||
jassertfalse; // you must make sure that the window contains all the samples you're going to attempt to read.
|
||||
|
|
|
|||
|
|
@ -1858,6 +1858,9 @@ public:
|
|||
clearSamplesBeyondAvailableLength (destSamples, numDestChannels, startOffsetInDestBuffer,
|
||||
startSampleInFile, numSamples, lengthInSamples);
|
||||
|
||||
if (numSamples <= 0)
|
||||
return true;
|
||||
|
||||
if (map == nullptr || ! mappedSection.contains (Range<int64> (startSampleInFile, startSampleInFile + numSamples)))
|
||||
{
|
||||
jassertfalse; // you must make sure that the window contains all the samples you're going to attempt to read.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue