Closed Crypto2 closed 5 years ago
Hello.
Strange, it never crashed for me on any platform I tested – which includes Windows/MSVC, Windows/MinGW as well as Linux/GCC. Anyhow, after taking a closer look at the section you are referring to, I think I may know what's going on: There is a very small chance that the first ("front") element in m_gainHistory_original[channel]
happens to be the smallest one – in which case std::min_element()
returns an iterator pointing at that "front" element. And, in this particular case, calling pop_front()
might invalidate the iterator. So it could explain the crash when trying to dereference the iterator later on.
Thanks for your report. Fix is on the way 😅
Best Regards, MuldeR
Should be fixed by 61ab8255d9bff6eb3f41068822b074ae4500a09e.
Yep, that's exactly what I figured happened. Just my luck to be the one to find it :)
In the API library there is a crash when running, if you check line 913 of DynamicAudioNormalizer.cpp:
const std::deque::iterator minimum = std::min_element(m_gainHistory_original[channel].begin(), m_gainHistory_original[channel].end());
m_gainHistory_original[channel].pop_front();
m_gainHistory_minimum[channel].push_back(minimum);
m_loggingData_minimum[channel].push(minimum);
Fix is just to rearrange the lines to:
const std::deque::iterator minimum = std::min_element(m_gainHistory_original[channel].begin(), m_gainHistory_original[channel].end());
m_gainHistory_minimum[channel].push_back(minimum);
m_loggingData_minimum[channel].push(minimum);
m_gainHistory_original[channel].pop_front();