From 44e75aa7b7f9a4f69a91e75691557a2b809949eb Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Tue, 4 Oct 2011 10:52:43 +0300 Subject: demux_ts: save pcr pid from pmt --- src/demuxers/demux_ts.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index c606d52a8..491942adc 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -329,6 +329,7 @@ typedef struct { * and audio PIDs, we keep the index of the corresponding entry * inthe media[] array. */ + unsigned int pcr_pid; unsigned int videoPid; unsigned int videoMedia; @@ -666,6 +667,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, this->last_pmt_crc = 0; this->videoPid = INVALID_PID; this->spu_pid = INVALID_PID; + this->pcr_pid = INVALID_PID; if (this->pmt[program_count] != NULL) { free(this->pmt[program_count]); @@ -1581,23 +1583,21 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num section_length -= coded_length; } -#if 0 /* * Get the current PCR PID. */ pid = ((this->pmt[program_count][8] << 8) | this->pmt[program_count][9]) & 0x1fff; - if (this->pcrPid != pid) { + if (this->pcr_pid != pid) { #ifdef TS_PMT_LOG - if (this->pcrPid == INVALID_PID) { + if (this->pcr_pid == INVALID_PID) { printf ("demux_ts: PMT pcr pid 0x%.4x\n", pid); } else { printf ("demux_ts: PMT pcr pid changed 0x%.4x\n", pid); } #endif - this->pcrPid = pid; + this->pcr_pid = pid; } -#endif if ( this->stream->spu_channel>=0 && this->spu_langs_count>0 ) demux_ts_update_spu_channel( this ); @@ -2045,6 +2045,7 @@ static void demux_ts_event_handler (demux_ts_t *this) { case XINE_EVENT_PIDS_CHANGE: this->videoPid = INVALID_PID; + this->pcr_pid = INVALID_PID; this->audio_tracks_count = 0; this->media_num = 0; this->send_newpts = 1; @@ -2125,6 +2126,7 @@ static void demux_ts_send_headers (demux_plugin_t *this_gen) { */ this->videoPid = INVALID_PID; + this->pcr_pid = INVALID_PID; this->audio_tracks_count = 0; this->media_num= 0; this->last_pmt_crc = 0; @@ -2383,6 +2385,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, this->scrambled_npids = 0; this->videoPid = INVALID_PID; + this->pcr_pid = INVALID_PID; this->audio_tracks_count = 0; this->last_pmt_crc = 0; -- cgit v1.2.3 From 06a273f4917e5b7460985a33a96276b0f84dc8b1 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Tue, 4 Oct 2011 11:14:55 +0300 Subject: demux_real: fixed buffer size check Check used (NULL) target pointer instead of length and would be always false --- src/demuxers/demux_real.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index 340083221..19b7794ef 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -303,7 +303,7 @@ static mdpr_t *real_parse_mdpr(const char *data, const unsigned int size) mdpr->mime_type[(int)mdpr->mime_type_size]=0; mdpr->type_specific_len=_X_BE_32(&data[34+mdpr->stream_name_size+mdpr->mime_type_size]); - if (size < 38 + mdpr->stream_name_size + mdpr->mime_type_size + mdpr->type_specific_data) + if (size < 38 + mdpr->stream_name_size + mdpr->mime_type_size + mdpr->type_specific_len) goto fail; mdpr->type_specific_data=malloc(mdpr->type_specific_len); if (!mdpr->type_specific_data) -- cgit v1.2.3 From 0c0175429f974b607f085c56be152ed5c3c20251 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Tue, 4 Oct 2011 11:16:10 +0300 Subject: demux_qt: fixed using uninitialized data --- src/demuxers/demux_qt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 7c6f7efe3..70b325535 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -1802,11 +1802,12 @@ static void get_next_edit_list_entry(qt_trak *trak, int64_t *edit_list_duration, unsigned int global_timescale) { + *edit_list_media_time = 0; + *edit_list_duration = MAX_DURATION; + /* if there is no edit list, set to max duration and get out */ if (!trak->edit_list_table) { - *edit_list_media_time = 0; - *edit_list_duration = MAX_DURATION; debug_edit_list(" qt: no edit list table, initial = %d, %"PRId64"\n", *edit_list_media_time, *edit_list_duration); return; -- cgit v1.2.3 From 6bccdb3cd66f73336bb754baa045af1fefd5588b Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Tue, 4 Oct 2011 11:20:57 +0300 Subject: demux_ogg: check asprintf return value --- src/demuxers/demux_ogg.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index 573baa593..14a8ac29a 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -468,9 +468,10 @@ static int read_comments (demux_ogg_t *this, const char *comment) if (!strncasecmp (metadata[i].tag, comment, ml) && comment[ml]) { if (metadata[i].append && this->meta[metadata[i].meta]) { char *newstr; - asprintf (&newstr, "%s\n%s", this->meta[metadata[i].meta], comment + ml); - free (this->meta[metadata[i].meta]); - this->meta[metadata[i].meta] = newstr; + if (asprintf (&newstr, "%s\n%s", this->meta[metadata[i].meta], comment + ml) >= 0) { + free (this->meta[metadata[i].meta]); + this->meta[metadata[i].meta] = newstr; + } } else { free (this->meta[metadata[i].meta]); -- cgit v1.2.3 From 7bf45d72df8abccbb2a56c86446aaeaca70f5fbf Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Tue, 4 Oct 2011 11:22:21 +0300 Subject: demux_qt: check asprintf() return value --- src/demuxers/demux_qt.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 70b325535..d0fa3fd77 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -710,9 +710,11 @@ static char *qtl_file_url (input_plugin_t *input, const unsigned char *preview, { /* relative */ const char *dir = input->get_mrl (input); slash = strrchr (dir, '/'); - asprintf (&url, "%.*s/%s", - slash ? (int)(slash - dir) : 1, - slash ? dir : ".", url); + if (asprintf (&url, "%.*s/%s", + slash ? (int)(slash - dir) : 1, + slash ? dir : ".", url) < 0) { + url = NULL; + } } } -- cgit v1.2.3 From 7e458b3e9af11628783d7c67bc2ca60c2cd3cfd0 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Tue, 4 Oct 2011 11:22:41 +0300 Subject: fixed remaining compiler warnings from demuxers --- src/demuxers/demux_aiff.c | 2 +- src/demuxers/demux_ogg.c | 2 ++ src/demuxers/demux_tta.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/demuxers/demux_aiff.c b/src/demuxers/demux_aiff.c index ee45963a5..0b4f5c513 100644 --- a/src/demuxers/demux_aiff.c +++ b/src/demuxers/demux_aiff.c @@ -94,7 +94,7 @@ static int extended_to_int(const unsigned char p[10]) m = (m<<8) + p[2+i];; e = (((int)p[0]&0x7f)<<8) | p[1]; if (e == 0x7fff && m) - return 0.0/0.0; + return (int)(0.0/0.0); e -= 16383 + 63; if (p[0]&0x80) diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index 14a8ac29a..e0abd0cd6 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -446,6 +446,7 @@ static const struct ogg_meta { OGG_META (COMMENT, 0), }; +#if 0 /* ensure that those marked "append" are cleared */ /* FIXME: is this useful? Should they be cleared on first write? */ static void prepare_read_comments (demux_ogg_t *this) @@ -458,6 +459,7 @@ static void prepare_read_comments (demux_ogg_t *this) this->meta[metadata[i].meta] = NULL; } } +#endif static int read_comments (demux_ogg_t *this, const char *comment) { diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index 57d2c8357..cf3745211 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -100,7 +100,7 @@ static int open_tta_file(demux_tta_t *this) { } this->seektable = calloc(this->totalframes, sizeof(uint32_t)); - this->input->read(this->input, this->seektable, sizeof(uint32_t)*this->totalframes); + this->input->read(this->input, (uint8_t*)this->seektable, sizeof(uint32_t)*this->totalframes); /* Skip the CRC32 */ this->input->seek(this->input, 4, SEEK_CUR); -- cgit v1.2.3