summaryrefslogtreecommitdiff
path: root/libavfilter/graphparser.c
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2008-05-24 20:39:42 +0000
committerVitor Sessak <vitor1001@gmail.com>2008-05-24 20:39:42 +0000
commit22260824c0444894e6e10e428907e4b0ca041c65 (patch)
tree626a165dbdb8a11b7c8ca1de572b942df3d82e8a /libavfilter/graphparser.c
parent325cb1efb2aa04066763d37cfa484549bfecb532 (diff)
Better error messages
Commited in SoC by Vitor Sessak on 2008-04-10 18:35:09 Originally committed as revision 13304 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavfilter/graphparser.c')
-rw-r--r--libavfilter/graphparser.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c
index d9760ffbe5..76ceacc547 100644
--- a/libavfilter/graphparser.c
+++ b/libavfilter/graphparser.c
@@ -139,20 +139,27 @@ static char *consume_string(const char **buf)
*/
static void parse_link_name(const char **buf, char **name)
{
+ const char *start = *buf;
(*buf)++;
*name = consume_string(buf);
- if(!*name[0])
+ if(!*name[0]) {
+ av_log(&log_ctx, AV_LOG_ERROR,
+ "Bad (empty?) label found in the following: \"%s\".\n", start);
goto fail;
+ }
- if(*(*buf)++ != ']')
+ if(*(*buf)++ != ']') {
+ av_log(&log_ctx, AV_LOG_ERROR,
+ "Mismatched '[' found in the following: \"%s\".\n", start);
goto fail;
+ }
return;
+
fail:
av_freep(name);
- av_log(&log_ctx, AV_LOG_ERROR, "Could not parse link name!\n");
}
/**
@@ -212,6 +219,12 @@ static int parse_inouts(const char **buf, AVFilterInOut **inout, int pad,
while (**buf == '[') {
AVFilterInOut *inoutn = av_malloc(sizeof(AVFilterInOut));
parse_link_name(buf, &inoutn->name);
+
+ if (!inoutn->name) {
+ av_free(inoutn);
+ return -1;
+ }
+
inoutn->type = type;
inoutn->filter = filter;
inoutn->pad_idx = pad++;
@@ -263,6 +276,9 @@ int avfilter_parse_graph(AVFilterGraph *graph, const char *filters,
pad = parse_inouts(&inouts, &inout, chr == ',', LinkTypeIn, filter);
+ if(pad < 0)
+ goto fail;
+
// If the first filter has an input and none was given, it is
// implicitly the input of the whole graph.
if(pad == 0 && filter->input_count == 1) {