From e842b584050390ac2524834acd986295a14e0aaa Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Fri, 13 Jan 2012 13:46:28 +0000 Subject: [PATCH 1/7] x264enc: remove leaking "optimization" --- ext/x264/gstx264enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/x264/gstx264enc.c b/ext/x264/gstx264enc.c index f85a94e0f7..2be3dd3b9c 100644 --- a/ext/x264/gstx264enc.c +++ b/ext/x264/gstx264enc.c @@ -431,7 +431,7 @@ gst_x264_enc_build_tunings_string (GstX264Enc * x264enc) { int i = 1; - if (x264enc->tunings && x264enc->tunings->len) + if (x264enc->tunings) g_string_free (x264enc->tunings, TRUE); if (x264enc->psy_tune) { From 69541031da9302b8fe6bfbb3e52a213400fa287b Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Fri, 13 Jan 2012 13:46:50 +0000 Subject: [PATCH 2/7] x264enc: remove useless and semantically (though not practically) wrong code The object will be freed, so it's pointless to set the pointers to NULL anyway. --- ext/x264/gstx264enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/x264/gstx264enc.c b/ext/x264/gstx264enc.c index 2be3dd3b9c..ea3cf0bf9c 100644 --- a/ext/x264/gstx264enc.c +++ b/ext/x264/gstx264enc.c @@ -962,7 +962,7 @@ gst_x264_enc_finalize (GObject * object) #define FREE_STRING(ptr) \ if (ptr) \ - ptr = (GString *)g_string_free (ptr, TRUE); + g_string_free (ptr, TRUE); FREE_STRING (encoder->tunings); FREE_STRING (encoder->option_string); From 683f5eeae7b830e4e4b790f3817ff6b8ce517b1c Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Fri, 13 Jan 2012 15:03:50 +0000 Subject: [PATCH 3/7] dvdreadsrc: fix off by one in cell calculation for the last chapter --- ext/dvdread/dvdreadsrc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/dvdread/dvdreadsrc.c b/ext/dvdread/dvdreadsrc.c index 1ed59e54f8..9877f07247 100644 --- a/ext/dvdread/dvdreadsrc.c +++ b/ext/dvdread/dvdreadsrc.c @@ -325,11 +325,14 @@ cur_title_get_chapter_bounds (GstDvdReadSrc * src, gint chapter, *p_first_cell = pgc->program_map[pgn - 1] - 1; if (chapter == (src->num_chapters - 1)) { - *p_last_cell = pgc->nr_of_cells; + *p_last_cell = pgc->nr_of_cells - 1; } else { pgn_next_ch = src->vts_ptt_srpt->title[src->ttn - 1].ptt[chapter + 1].pgn; *p_last_cell = pgc->program_map[pgn_next_ch - 1] - 1; } + + GST_DEBUG_OBJECT (src, "Chapter %d bounds: %d %d (within %d cells)", + chapter, *p_first_cell, *p_last_cell, pgc->nr_of_cells); } static gboolean From 1d71315dc910228e6ca21c26367d8f8aecf2e2d4 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Tue, 17 Jan 2012 11:55:14 +0100 Subject: [PATCH 4/7] amrnbdec: _parse should not return OK if not enough data yet --- ext/amrnb/amrnbdec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/amrnb/amrnbdec.c b/ext/amrnb/amrnbdec.c index 5f6c64b39b..bf59d8de50 100644 --- a/ext/amrnb/amrnbdec.c +++ b/ext/amrnb/amrnbdec.c @@ -257,7 +257,7 @@ gst_amrnbdec_parse (GstAudioDecoder * dec, GstAdapter * adapter, gst_audio_decoder_get_parse_state (dec, &sync, &eos); /* need to peek data to get the size */ - if (gst_adapter_available (adapter) < 1) + if (size < 1) return GST_FLOW_ERROR; data = gst_adapter_peek (adapter, 1); @@ -280,6 +280,9 @@ gst_amrnbdec_parse (GstAudioDecoder * dec, GstAdapter * adapter, GST_DEBUG_OBJECT (amrnbdec, "mode %d, block %d", mode, block); + if (block > size) + return GST_FLOW_UNEXPECTED; + *offset = 0; *length = block; From 7b513433631d8ff9aaa9f9b128b2b21891041ff3 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Tue, 17 Jan 2012 11:55:59 +0100 Subject: [PATCH 5/7] amrwbdec: _parse should not return OK if not enough data yet --- ext/amrwbdec/amrwbdec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/amrwbdec/amrwbdec.c b/ext/amrwbdec/amrwbdec.c index e056a7a9df..53358661d3 100644 --- a/ext/amrwbdec/amrwbdec.c +++ b/ext/amrwbdec/amrwbdec.c @@ -183,7 +183,7 @@ gst_amrwbdec_parse (GstAudioDecoder * dec, GstAdapter * adapter, gst_audio_decoder_get_parse_state (dec, &sync, &eos); /* need to peek data to get the size */ - if (gst_adapter_available (adapter) < 1) + if (size < 1) return GST_FLOW_ERROR; data = gst_adapter_peek (adapter, 1); @@ -193,6 +193,8 @@ gst_amrwbdec_parse (GstAudioDecoder * dec, GstAdapter * adapter, GST_DEBUG_OBJECT (amrwbdec, "mode %d, block %d", mode, block); if (block) { + if (block > size) + return GST_FLOW_UNEXPECTED; *offset = 0; *length = block; } else { From ac281f35629a394dd53562b6eda3b074cf06c6a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 19 Jan 2012 15:06:47 +0000 Subject: [PATCH 6/7] Add --disable-fatal-warnings configure option --- common | 2 +- configure.ac | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common b/common index 11f0cd5a3f..17fa4abf49 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 11f0cd5a3fba36f85cf3e434150bfe66b1bf08d4 +Subproject commit 17fa4abf49d31cf5dcc2994bdbaa86e45a3fb69f diff --git a/configure.ac b/configure.ac index a740b12403..20ba788ee3 100644 --- a/configure.ac +++ b/configure.ac @@ -71,6 +71,8 @@ AG_GST_GETTEXT([gst-plugins-ugly-$GST_MAJORMINOR]) dnl *** check for arguments to configure *** +AG_GST_ARG_DISABLE_FATAL_WARNINGS + AG_GST_ARG_DEBUG AG_GST_ARG_PROFILING AG_GST_ARG_VALGRIND @@ -187,14 +189,14 @@ AG_GST_SET_PACKAGE_RELEASE_DATETIME_WITH_NANO([$PACKAGE_VERSION_NANO], [$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_MICRO]) dnl define an ERROR_CFLAGS Makefile variable -AG_GST_SET_ERROR_CFLAGS($GST_GIT, [ +AG_GST_SET_ERROR_CFLAGS($FATAL_WARNINGS, [ -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wwrite-strings -Wformat-nonliteral -Wformat-security -Wold-style-definition -Winit-self -Wmissing-include-dirs -Waddress -Waggregate-return -Wno-multichar -Wnested-externs ]) dnl define an ERROR_CXXFLAGS Makefile variable -AG_GST_SET_ERROR_CXXFLAGS($GST_GIT, [ +AG_GST_SET_ERROR_CXXFLAGS($FATAL_WARNINGS, [ -Wmissing-declarations -Wredundant-decls -Wwrite-strings -Wformat-nonliteral -Wformat-security -Winit-self -Wmissing-include-dirs -Waddress -Waggregate-return From 1651493ae0e20c91b3a46e950339fa1eb6d977ea Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Thu, 19 Jan 2012 15:26:25 +0000 Subject: [PATCH 7/7] a52dec: fix read buffer overflow upon syncing The wrong size was being decremented, leading to a runaway read loop. --- ext/a52dec/gsta52dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/a52dec/gsta52dec.c b/ext/a52dec/gsta52dec.c index 18ea1da20b..3ada93f188 100644 --- a/ext/a52dec/gsta52dec.c +++ b/ext/a52dec/gsta52dec.c @@ -309,7 +309,7 @@ gst_a52dec_parse (GstAudioDecoder * bdec, GstAdapter * adapter, bit_rate = a52dec->bit_rate; sample_rate = a52dec->sample_rate; flags = 0; - while (av >= 7) { + while (size >= 7) { length = a52_syncinfo (data, &flags, &sample_rate, &bit_rate); if (length == 0) {