aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/alplay.c2
-rw-r--r--examples/alstream.c2
-rw-r--r--examples/alstreamcb.cpp4
3 files changed, 4 insertions, 4 deletions
diff --git a/examples/alplay.c b/examples/alplay.c
index e477df28..6f6c8699 100644
--- a/examples/alplay.c
+++ b/examples/alplay.c
@@ -122,7 +122,7 @@ static ALuint LoadSound(const char *filename)
/* If there's an issue getting the chunk or block alignment, load as
* 16-bit and have libsndfile do the conversion.
*/
- if(!iter || sf_get_chunk_size(iter, &inf) != SF_ERR_NO_ERROR)
+ if(!iter || sf_get_chunk_size(iter, &inf) != SF_ERR_NO_ERROR || inf.datalen < 14)
sample_format = Int16;
else
{
diff --git a/examples/alstream.c b/examples/alstream.c
index b561406c..e89481b1 100644
--- a/examples/alstream.c
+++ b/examples/alstream.c
@@ -185,7 +185,7 @@ static int OpenPlayerFile(StreamPlayer *player, const char *filename)
/* If there's an issue getting the chunk or block alignment, load as
* 16-bit and have libsndfile do the conversion.
*/
- if(!iter || sf_get_chunk_size(iter, &inf) != SF_ERR_NO_ERROR)
+ if(!iter || sf_get_chunk_size(iter, &inf) != SF_ERR_NO_ERROR || inf.datalen < 14)
player->sample_type = Int16;
else
{
diff --git a/examples/alstreamcb.cpp b/examples/alstreamcb.cpp
index 994a9c97..c7ebcbe3 100644
--- a/examples/alstreamcb.cpp
+++ b/examples/alstreamcb.cpp
@@ -157,9 +157,9 @@ struct StreamPlayer {
int splblocksize{}, byteblocksize{};
if(mSampleFormat == SampleType::IMA4 || mSampleFormat == SampleType::MSADPCM)
{
- SF_CHUNK_INFO inf{ "fmt ", 4, 0, NULL };
+ SF_CHUNK_INFO inf{ "fmt ", 4, 0, nullptr };
SF_CHUNK_ITERATOR *iter = sf_get_chunk_iterator(mSndfile, &inf);
- if(!iter || sf_get_chunk_size(iter, &inf) != SF_ERR_NO_ERROR)
+ if(!iter || sf_get_chunk_size(iter, &inf) != SF_ERR_NO_ERROR || inf.datalen < 14)
mSampleFormat = SampleType::Int16;
else
{