mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2025-02-26 08:22:31 +00:00
Fix for the case "overwrite element at the end of the file"
Fixes a crash in mmg when saving chapters to a Matroska file.
This commit is contained in:
parent
678e86e6e4
commit
2cce28ca43
@ -1,3 +1,8 @@
|
||||
2010-02-11 Moritz Bunkus <moritz@bunkus.org>
|
||||
|
||||
* mmg, mkvpropedit: Fixed another bug causing a crash writing
|
||||
chapters/other elements to existing Matroska files.
|
||||
|
||||
2010-02-10 Moritz Bunkus <moritz@bunkus.org>
|
||||
|
||||
* Build system: bug fix: Improved detection of Boost::Filesystem
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user