From fcbe6b82b07f4ea076722c5b315da8c341214f22 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 19 Jul 2004 20:01:20 +0000 Subject: [PATCH] Use proper indexes for the set_as_default_track function and NOT the indexes from libmatroska for track_*. --- ChangeLog | 4 ++++ src/input/r_matroska.cpp | 4 +++- src/pr_generic.cpp | 12 ++++++------ src/pr_generic.h | 4 ++++ 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4b2b23535..c719da007 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2004-07-19 Moritz Bunkus + * mkvmerge: bug fix: The Matroska reader contained a nice little + illegal memory access (introduced in 0.9.3 with the fixes to the + 'default track' handling). + * mkvmerge: bug fix: The SSA reader was segfaulting if a line contained an empty text field. diff --git a/src/input/r_matroska.cpp b/src/input/r_matroska.cpp index 52e86bde6..a0b192250 100644 --- a/src/input/r_matroska.cpp +++ b/src/input/r_matroska.cpp @@ -1430,7 +1430,9 @@ kax_reader_c::init_passthrough_packetizer(kax_track_t *t) { void kax_reader_c::set_packetizer_headers(kax_track_t *t) { if (t->default_track) - PTZR(t->ptzr)->set_as_default_track(MAP_TRACK_TYPE(t->type), + PTZR(t->ptzr)->set_as_default_track(t->type == 'v' ? DEFTRACK_TYPE_VIDEO : + t->type == 'a' ? DEFTRACK_TYPE_AUDIO : + DEFTRACK_TYPE_SUBS, DEFAULT_TRACK_PRIORITY_FROM_SOURCE); if (t->tuid != 0) if (!PTZR(t->ptzr)->set_uid(t->tuid)) diff --git a/src/pr_generic.cpp b/src/pr_generic.cpp index 83f479ca8..155aa9ccb 100644 --- a/src/pr_generic.cpp +++ b/src/pr_generic.cpp @@ -543,11 +543,11 @@ generic_packetizer_c::set_headers() { htrack_default_duration; if (htrack_type == track_audio) - idx = 0; + idx = DEFTRACK_TYPE_AUDIO; else if (htrack_type == track_video) - idx = 1; + idx = DEFTRACK_TYPE_VIDEO; else - idx = 2; + idx = DEFTRACK_TYPE_SUBS; if (ti->default_track) set_as_default_track(idx, DEFAULT_TRACK_PRIORITY_CMDLINE); @@ -686,11 +686,11 @@ generic_packetizer_c::fix_headers() { int idx; if (htrack_type == track_audio) - idx = 0; + idx = DEFTRACK_TYPE_AUDIO; else if (htrack_type == track_video) - idx = 1; + idx = DEFTRACK_TYPE_VIDEO; else - idx = 2; + idx = DEFTRACK_TYPE_SUBS; if (default_tracks[idx] == hserialno) *(static_cast diff --git a/src/pr_generic.h b/src/pr_generic.h index 85f87e914..1ff2c0999 100644 --- a/src/pr_generic.h +++ b/src/pr_generic.h @@ -53,6 +53,10 @@ using namespace std; #define CUES_ALL 2 #define CUES_SPARSE 3 +#define DEFTRACK_TYPE_AUDIO 0 +#define DEFTRACK_TYPE_VIDEO 1 +#define DEFTRACK_TYPE_SUBS 2 + class memory_c { public: unsigned char *data;