diff --git a/NEWS.md b/NEWS.md index dda294f5e..4fc5052dd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -20,6 +20,8 @@ from "at least one entry selected" to "no entry selected", the input controls will be reset to their default state and not just disabled. Fixes #2927. +* mkvmerge: HEVC parser: fixed mkvmerge aborting after uncaught exceptions due + to certain data constellations found by fuzzying. # Version 50.0.0 "Awakenings" 2020-09-06 diff --git a/src/common/hevc_es_parser.cpp b/src/common/hevc_es_parser.cpp index a93c56155..a0b560b0e 100644 --- a/src/common/hevc_es_parser.cpp +++ b/src/common/hevc_es_parser.cpp @@ -469,8 +469,8 @@ es_parser_c::handle_sei_nalu(memory_cptr const &nalu) { } void -es_parser_c::handle_nalu(memory_cptr const &nalu, - uint64_t nalu_pos) { +es_parser_c::handle_nalu_internal(memory_cptr const &nalu, + uint64_t nalu_pos) { if (1 > nalu->get_size()) return; @@ -546,6 +546,17 @@ es_parser_c::handle_nalu(memory_cptr const &nalu, } } +void +es_parser_c::handle_nalu(memory_cptr const &nalu, + uint64_t nalu_pos) { + try { + handle_nalu_internal(nalu, nalu_pos); + + } catch (bool) { + } catch (mtx::mm_io::end_of_file_x const &) { + } +} + bool es_parser_c::parse_slice(memory_cptr const &nalu, slice_info_t &si) { diff --git a/src/common/hevc_es_parser.h b/src/common/hevc_es_parser.h index 8920d4b8a..147b591d6 100644 --- a/src/common/hevc_es_parser.h +++ b/src/common/hevc_es_parser.h @@ -208,6 +208,7 @@ public: protected: bool parse_slice(memory_cptr const &nalu, slice_info_t &si); + void handle_nalu_internal(memory_cptr const &nalu, uint64_t nalu_pos); void handle_vps_nalu(memory_cptr const &nalu); void handle_sps_nalu(memory_cptr const &nalu); void handle_pps_nalu(memory_cptr const &nalu); diff --git a/tests/results.txt b/tests/results.txt index f2195f147..0012716bb 100644 --- a/tests/results.txt +++ b/tests/results.txt @@ -555,3 +555,4 @@ T_706bcp47_mkvmerge_tracks_disable_language_ietf:d3debb1ac7a98668c4cac753891185b T_707bcp47_mkvmerge_chapters_disable_language_ietf:2a2202254f1e426484151e9299f83841-ok-b6807e13a6ea9a2cc609e86b3e9af87d-ok-b6807e13a6ea9a2cc609e86b3e9af87d-ok-b34723deaedf0499e3867766749863b2-ok-b34723deaedf0499e3867766749863b2-ok-b34723deaedf0499e3867766749863b2-ok-ff2908a5f9aedaca69790c4ec909a829-ok-fcf93dcc200afe462b71d16d7c9fef90-ok-fcf93dcc200afe462b71d16d7c9fef90-ok:passed:20200829-101752:0.197644079 T_708bcp47_propedit_language_ietf_disable_language_ietf:d80d696e8045ebf157d31db09142307c-und+und+ok+ger+und+ok+ger+pt_BR+ok+spa+pt_BR+ok+eng+pt_BR+ok+eng++ok:passed:20200829-103838:0.0 T_709bcp47_mkvmerge_tags:9208217d36fa9368be5a44b239286424:passed:20200903-234135:0.0 +T_710fuzzying:8a854a7b177603c5291752d2f9520fa0-1b04d1875e32404c86dbef16ddb75db0:passed:20200921-133156:0.016287719 diff --git a/tests/test-710fuzzying.rb b/tests/test-710fuzzying.rb new file mode 100755 index 000000000..7ed2449a5 --- /dev/null +++ b/tests/test-710fuzzying.rb @@ -0,0 +1,9 @@ +#!/usr/bin/ruby -w + +# T_710fuzzying +describe "mkvmerge / issues found by fuzzying" + +Dir["data/segfaults-assertions/fuzzying/0001-ac3/**/id*"].each do |file| + exit_code = file.gsub(%r{.*/([012])/.*}, '\1').to_i + test_merge file, :exit_code => exit_code +end