aboutsummaryrefslogtreecommitdiffstats
path: root/examples/alstreamcb.cpp
diff options
context:
space:
mode:
authorChris Robinson <chris.kcat@gmail.com>2023-03-05 00:29:24 -0800
committerChris Robinson <chris.kcat@gmail.com>2023-03-05 00:29:24 -0800
commit442cfdd14ea01f8c9d494d544213b40dc696841f (patch)
tree596394350052bfc31b6eef99965ad138a55823a2 /examples/alstreamcb.cpp
parentef45eccd6cbf736aa4a364b92e6089568091ed2e (diff)
Make sure the fmt chunk is large enough
Diffstat (limited to 'examples/alstreamcb.cpp')
-rw-r--r--examples/alstreamcb.cpp4
1 files changed, 2 insertions, 2 deletions
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
{