kax_analyzer_c: update internal records after removing trailing void elements

The actual file modification was executed (truncating before the last
void element), but the internal representation wasn't updated. This
lead to following validity checks to fail as what was expected to be
in the file didn't match what actually was in the file.

Part of the fix of #3325.
This commit is contained in:
Moritz Bunkus 2022-04-15 20:59:14 +02:00
parent 4113de427c
commit 39377265c5
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
2 changed files with 8 additions and 0 deletions

View File

@ -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

View File

@ -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