diff --git a/ChangeLog b/ChangeLog index 053549e85..090263c06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2016-09-06 Moritz Bunkus + * mkvmerge: bug fix: AAC reader: fixed mkvmerge throwing an + uncaught exception due to the sample rate being 0. Fixes a test + case of #1780. + * mkvmerge: bug fix: MP4 reader: fixed an invalid memory access (beyond the end of allocated space). Fixes several test cases of #1780. diff --git a/src/input/r_aac.cpp b/src/input/r_aac.cpp index a40b7ad0c..8ecb58b6a 100644 --- a/src/input/r_aac.cpp +++ b/src/input/r_aac.cpp @@ -64,10 +64,18 @@ aac_reader_c::read_headers() { m_parser.copy_data(false); m_parser.add_bytes(m_chunk->get_buffer(), init_read_len); - if (!m_parser.frames_available() || !m_parser.headers_parsed()) + if (!m_parser.headers_parsed()) + throw mtx::input::header_parsing_x(); + + while (m_parser.frames_available()) { + m_aacheader = m_parser.get_frame().m_header; + if (m_aacheader.sample_rate > 0) + break; + } + + if (!m_aacheader.sample_rate) throw mtx::input::header_parsing_x(); - m_aacheader = m_parser.get_frame().m_header; m_parser = aac::parser_c{}; m_ti.m_id = 0; // ID for this track. diff --git a/tests/results.txt b/tests/results.txt index a5970f840..f1de183bf 100644 --- a/tests/results.txt +++ b/tests/results.txt @@ -406,3 +406,4 @@ T_557dts_hd_ma_xll_extension:96000-192000-7f61832d35165f4600c0ac06b3a109dc-7f618 T_558segfaults_issue_1780_part_1:error-error-error-error-error:passed:20160906-210126:0.035867258 T_559segfaults_issue_1780_part_2:error-error-error-error-error-error-error-error-error-error-error-error-error-error-error-error-error-error-error-error-error-error-error-error-error-error-error-error:passed:20160906-225430:0.206571838 T_560segfaults_issue_1780_part_3:0489485fc50810d2c60f480348ed4f98-0489485fc50810d2c60f480348ed4f98-0489485fc50810d2c60f480348ed4f98-0489485fc50810d2c60f480348ed4f98-0489485fc50810d2c60f480348ed4f98-0489485fc50810d2c60f480348ed4f98-0489485fc50810d2c60f480348ed4f98-b21ab40761d8b1bbf3f0e56f93cc3b9b-912643da6854328e5fbd5c2be062e2d4-0489485fc50810d2c60f480348ed4f98-6419cd823516f4f0f61ba6bf08fe8897-b400b47306ae8b4ca48ec43444336b5a-c64dcaf5f603f78524fb88b012c9ea5b-0489485fc50810d2c60f480348ed4f98-a4804262c5ca204ef138510263fb853f-49c8bafe5be3fee7f72bb82da798fba8-87a837d6a523dbf906cef7bcb3f3bcfd-87a837d6a523dbf906cef7bcb3f3bcfd-87a837d6a523dbf906cef7bcb3f3bcfd-87a837d6a523dbf906cef7bcb3f3bcfd-87a837d6a523dbf906cef7bcb3f3bcfd:passed:20160906-225653:0.203842645 +T_561segfaults_issue_1780_part_4:error:passed:20160906-225808:0.007751455 diff --git a/tests/test-561segfaults_issue_1780_part_4.rb b/tests/test-561segfaults_issue_1780_part_4.rb new file mode 100755 index 000000000..0f9c58486 --- /dev/null +++ b/tests/test-561segfaults_issue_1780_part_4.rb @@ -0,0 +1,9 @@ +#!/usr/bin/ruby -w + +# T_561segfaults_issue_1780_part_4 +describe "mkvmerge / various test cases for segfaults collected in issue 1780 part 4" + +dir = "data/segfaults-assertions/issue-1780" + +# "AAC reader: keep reading until frame with sample rate > 0 is found" +test_merge "#{dir}/explorer:id:000019,sig:06,src:000000,op:flip2,pos:2", :exit_code => :error