AAC reader: keep reading until frame with sample rate > 0 is found

Prevents an uncaught exception in the AAC packetizer as it requires the
sample rate to be set properly. Fixes the following test case of #1780:

explorer🆔000019,sig:06,src:000000,op:flip2,pos:2
This commit is contained in:
Moritz Bunkus 2016-09-06 22:07:49 +02:00
parent 1e5f31b3f6
commit 27ce4e219c
4 changed files with 24 additions and 2 deletions

View File

@ -1,5 +1,9 @@
2016-09-06 Moritz Bunkus <moritz@bunkus.org>
* 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.

View File

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

View File

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

View File

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