diff --git a/NEWS.md b/NEWS.md index a3e031094..18f6d43f2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -17,6 +17,9 @@ element would shrink the element by one byte. Files created by gstreamer fit the first part whereas the second depends on the changes requested by the user. Part of the fix of #3325. +* mkvpropedit, MKVToolNix GUI's chapter & header editors: fixed the programs + not handling having to remove EBML void elements at the end of the file + correctly and consequently aborting. Part of the fix of #3325. # Version 67.0.0 "Under Stars" 2022-04-10 diff --git a/src/common/kax_analyzer.cpp b/src/common/kax_analyzer.cpp index f65dd113d..99d024263 100644 --- a/src/common/kax_analyzer.cpp +++ b/src/common/kax_analyzer.cpp @@ -1032,9 +1032,14 @@ kax_analyzer_c::merge_void_elements() { if (m_data.size() <= start_idx) return; + mxdebug_if(m_debug, fmt::format("merge_void_elements: removing trailing void elements from start_idx {0} to m_data.size {1}\n", start_idx, m_data.size())); + // Truncate the file after the last non-void element and update the segment size. m_file->truncate(m_data[start_idx]->m_pos); adjust_segment_size(); + + // Lastly remove the elements from our internal records. + m_data.erase(m_data.begin() + start_idx, m_data.end()); } /** \brief Finds a suitable spot for an element and writes it to the file