HEVC parser: catch exceptions during NALU parsing

Found by fuzzying.
This commit is contained in:
Moritz Bunkus 2020-09-21 13:32:56 +02:00
parent 74c5272591
commit 26bbd99ec2
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
5 changed files with 26 additions and 2 deletions

View File

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

View File

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

View File

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

View File

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

9
tests/test-710fuzzying.rb Executable file
View File

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