IVF reader: test track parameters for validity

Otherwise dividing by zero might happen, or libEBML aborting due to
mandatory fields (pixel width/height) not being set.

Found by fuzzying.
This commit is contained in:
Moritz Bunkus 2020-09-23 12:23:29 +02:00
parent edf73c0d85
commit d50ddeebbb
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
4 changed files with 20 additions and 6 deletions

View File

@ -43,6 +43,8 @@
widget.
* mkvmerge: AV1 parser: fixed mkvmerge crashing after uncaught exceptions due
to certain data conditions. Found by fuzzying.
* mkvmerge: IVF reader: fixed mkvmerge crashing with a "division by zero"
error due to certain data conditions. Found by fuzzying.
# Version 50.0.0 "Awakenings" 2020-09-06

View File

@ -45,13 +45,20 @@ ivf_reader_c::read_headers() {
m_height = get_uint16_le(&m_header.height);
m_frame_rate_num = get_uint32_le(&m_header.frame_rate_num);
m_frame_rate_den = get_uint32_le(&m_header.frame_rate_den);
m_ok = m_width && m_height && m_frame_rate_num && m_frame_rate_den;
show_demuxer_info();
}
void
ivf_reader_c::add_available_track_ids() {
if (m_ok)
add_available_track_id(0);
}
void
ivf_reader_c::create_packetizer(int64_t) {
if (!demuxing_requested('v', 0) || (NPTZR() != 0))
if (!demuxing_requested('v', 0) || (NPTZR() != 0) || !m_ok)
return;
if (m_codec.is(codec_c::type_e::V_AV1))
@ -119,9 +126,12 @@ ivf_reader_c::read(generic_packetizer_c *,
void
ivf_reader_c::identify() {
id_result_container();
if (!m_ok)
return;
auto info = mtx::id::info_c{};
info.add(mtx::id::pixel_dimensions, fmt::format("{0}x{1}", m_width, m_height));
id_result_container();
id_result_track(0, ID_RESULT_TRACK_VIDEO, m_codec.get_name(), info.get());
}

View File

@ -23,9 +23,10 @@
class ivf_reader_c: public generic_reader_c {
private:
ivf::file_header_t m_header;
uint16_t m_width, m_height;
uint64_t m_frame_rate_num, m_frame_rate_den;
uint16_t m_width{}, m_height{};
uint64_t m_frame_rate_num{}, m_frame_rate_den{};
codec_c m_codec;
bool m_ok{};
debugging_option_c m_debug{"ivf_reader"};
public:
@ -33,6 +34,7 @@ public:
return mtx::file_type_e::ivf;
}
virtual void add_available_track_ids() override;
virtual void read_headers() override;
virtual void identify() override;
virtual void create_packetizer(int64_t id) override;

View File

@ -555,4 +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:ok-ok-ok-ok-ok-ok-ok-ok:passed:20200921-133156:0.059249045
T_710fuzzying:ok-ok-ok-ok-ok-ok-ok-ok-ok:passed:20200921-133156:0.059249045