From 0a9a2257339c8697be31e64b36fa6208132b11bd Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 11 Jun 2012 14:21:32 +0200 Subject: [PATCH 1/3] rtmp: Fix a possible access to invalid memory location when the playpath is too short. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavformat/rtmpproto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index e9a3e4336e..56011f1cde 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -1141,11 +1141,11 @@ static int rtmp_open(URLContext *s, const char *uri, int flags) goto fail; } - if (!strchr(fname, ':') && + if (!strchr(fname, ':') && len >= 4 && (!strcmp(fname + len - 4, ".f4v") || !strcmp(fname + len - 4, ".mp4"))) { memcpy(rt->playpath, "mp4:", 5); - } else if (!strcmp(fname + len - 4, ".flv")) { + } else if (len >= 4 && !strcmp(fname + len - 4, ".flv")) { fname[len - 4] = '\0'; } else { rt->playpath[0] = 0; From 47b812e9cec3e0b29799b71009585ea77133eef0 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 11 Jun 2012 15:34:12 +0200 Subject: [PATCH 2/3] avconv: support only native pthreads. Our w32pthreads wrapper has various issues and is only supposed to be used in libavcodec. --- avconv.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/avconv.c b/avconv.c index 7d50d583e5..293f839ee5 100644 --- a/avconv.c +++ b/avconv.c @@ -69,12 +69,8 @@ #include #endif -#if HAVE_THREADS #if HAVE_PTHREADS #include -#else -#include "libavcodec/w32pthreads.h" -#endif #endif #include @@ -148,7 +144,7 @@ static float dts_delta_threshold = 10; static int print_stats = 1; -#if HAVE_THREADS +#if HAVE_PTHREADS /* signal to input threads that they should exit; set by the main thread */ static int transcoding_finished; #endif @@ -233,7 +229,7 @@ typedef struct InputFile { from ctx.nb_streams if new streams appear during av_read_frame() */ int rate_emu; -#if HAVE_THREADS +#if HAVE_PTHREADS pthread_t thread; /* thread reading from this file */ int finished; /* the thread has exited */ int joined; /* the thread has been joined */ @@ -2787,7 +2783,7 @@ static int select_input_file(uint8_t *no_packet) return file_index; } -#if HAVE_THREADS +#if HAVE_PTHREADS static void *input_thread(void *arg) { InputFile *f = arg; @@ -2899,7 +2895,7 @@ static int get_input_packet_mt(InputFile *f, AVPacket *pkt) static int get_input_packet(InputFile *f, AVPacket *pkt) { -#if HAVE_THREADS +#if HAVE_PTHREADS if (nb_input_files > 1) return get_input_packet_mt(f, pkt); #endif @@ -2931,7 +2927,7 @@ static int transcode(void) timer_start = av_gettime(); -#if HAVE_THREADS +#if HAVE_PTHREADS if ((ret = init_input_threads()) < 0) goto fail; #endif @@ -3044,7 +3040,7 @@ static int transcode(void) /* dump report by using the output first video and audio streams */ print_report(0, timer_start); } -#if HAVE_THREADS +#if HAVE_PTHREADS free_input_threads(); #endif @@ -3091,7 +3087,7 @@ static int transcode(void) fail: av_freep(&no_packet); -#if HAVE_THREADS +#if HAVE_PTHREADS free_input_threads(); #endif From 65a80ee1ec854dc4e5d090fa5b2be9afeae312d3 Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Fri, 8 Jun 2012 12:02:04 -0700 Subject: [PATCH 3/3] avfilter: Log an error if avfilter fails to configure a link. --- libavfilter/avfilter.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 3dbb6920ee..9b62be33ca 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -163,8 +163,12 @@ int avfilter_config_links(AVFilterContext *filter) "callbacks on all outputs\n"); return AVERROR(EINVAL); } - } else if ((ret = config_link(link)) < 0) + } else if ((ret = config_link(link)) < 0) { + av_log(link->src, AV_LOG_ERROR, + "Failed to configure output pad on %s\n", + link->src->name); return ret; + } if (link->time_base.num == 0 && link->time_base.den == 0) link->time_base = link->src && link->src->input_count ? @@ -189,8 +193,12 @@ int avfilter_config_links(AVFilterContext *filter) } if ((config_link = link->dstpad->config_props)) - if ((ret = config_link(link)) < 0) + if ((ret = config_link(link)) < 0) { + av_log(link->src, AV_LOG_ERROR, + "Failed to configure input pad on %s\n", + link->dst->name); return ret; + } link->init_state = AVLINK_INIT; }