diff --git a/ChangeLog b/ChangeLog index 177b28452..3c96043b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-02-11 Moritz Bunkus + + * mmg, mkvpropedit: Fixed another bug causing a crash writing + chapters/other elements to existing Matroska files. + 2010-02-10 Moritz Bunkus * Build system: bug fix: Improved detection of Boost::Filesystem diff --git a/src/common/kax_analyzer.cpp b/src/common/kax_analyzer.cpp index 986059197..485857bc6 100644 --- a/src/common/kax_analyzer.cpp +++ b/src/common/kax_analyzer.cpp @@ -400,6 +400,17 @@ kax_analyzer_c::adjust_segment_size() { */ bool kax_analyzer_c::handle_void_elements(int data_idx) { + // Is the element at the end of the file? If so truncate the file + // and remove the element from the m_data structure if that was + // requested. Then we're done. + if (m_data.size() == (data_idx + 1)) { + m_file->truncate(m_data[data_idx]->m_pos + m_data[data_idx]->m_size); + adjust_segment_size(); + if (0 == m_data[data_idx]->m_size) + m_data.erase(m_data.begin() + data_idx); + return false; + } + // Are the following elements EbmlVoid elements? int end_idx = data_idx + 1; while ((m_data.size() > end_idx) && (m_data[end_idx]->m_id == EbmlVoid::ClassInfos.GlobalId))