From 88c9336b53dcb8da8fc78a5a5cda17e0175dd2cb Mon Sep 17 00:00:00 2001 From: Matthew Sheby <44249925+msheby@users.noreply.github.com> Date: Tue, 23 Nov 2021 22:14:44 -0800 Subject: correctly handle WAVE files that have chunks after the "data" chunk --- src/PCM_Parser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/PCM_Parser.cpp') diff --git a/src/PCM_Parser.cpp b/src/PCM_Parser.cpp index b8dea71..9efd388 100755 --- a/src/PCM_Parser.cpp +++ b/src/PCM_Parser.cpp @@ -170,9 +170,9 @@ ASDCP::PCM::WAVParser::h__WAVParser::ReadFrame(FrameBuffer& FB) } ui32_t read_count = 0; - Result_t result = m_FileReader.Read(FB.Data(), m_FrameBufferSize, &read_count); + Result_t result = m_FileReader.Read(FB.Data(), (m_DataLength - m_ReadCount >= m_FrameBufferSize) ? m_FrameBufferSize : m_DataLength - m_ReadCount, &read_count); - if ( result == RESULT_ENDOFFILE ) + if ( result == RESULT_ENDOFFILE || (m_DataLength == m_ReadCount + read_count) ) { m_EOF = true; -- cgit v1.2.3