From e6c7cdadc4c0a44b457ab937953521aecd59bc85 Mon Sep 17 00:00:00 2001 From: Gilles Boccon-Gibod Date: Fri, 12 Jun 2020 07:56:39 -0700 Subject: [PATCH] fix #517 --- Source/C++/Core/Ap4StszAtom.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Source/C++/Core/Ap4StszAtom.cpp b/Source/C++/Core/Ap4StszAtom.cpp index faa61a0ce..36e4b3600 100644 --- a/Source/C++/Core/Ap4StszAtom.cpp +++ b/Source/C++/Core/Ap4StszAtom.cpp @@ -78,8 +78,7 @@ AP4_StszAtom::AP4_StszAtom(AP4_UI32 size, } stream.ReadUI32(m_SampleSize); - AP4_UI32 sample_count; - stream.ReadUI32(sample_count); + stream.ReadUI32(m_SampleCount); if (m_SampleSize == 0) { // means that the samples have different sizes // check for overflow if (m_SampleCount > (size - AP4_FULL_ATOM_HEADER_SIZE - 8) / 4) { @@ -87,16 +86,15 @@ AP4_StszAtom::AP4_StszAtom(AP4_UI32 size, } // read the entries - unsigned char* buffer = new unsigned char[sample_count * 4]; - AP4_Result result = stream.Read(buffer, sample_count*4); + unsigned char* buffer = new unsigned char[m_SampleCount * 4]; + AP4_Result result = stream.Read(buffer, m_SampleCount * 4); if (AP4_FAILED(result)) { delete[] buffer; return; } - m_SampleCount = sample_count; - m_Entries.SetItemCount((AP4_Cardinal)sample_count); - for (unsigned int i=0; i