Mercurial > libavutil.hg
comparison eval.c @ 946:f05ed9190133 libavutil
Make av_parse_expr() fail if there are trailing chars at the end of
the provided expression.
Allow detection of mistyped expressions.
author | stefano |
---|---|
date | Wed, 16 Jun 2010 18:27:55 +0000 |
parents | 4059de4c9f90 |
children | 34a4ee230079 |
comparison
equal
deleted
inserted
replaced
945:4059de4c9f90 | 946:f05ed9190133 |
---|---|
446 { | 446 { |
447 Parser p; | 447 Parser p; |
448 AVExpr *e = NULL; | 448 AVExpr *e = NULL; |
449 char *w = av_malloc(strlen(s) + 1); | 449 char *w = av_malloc(strlen(s) + 1); |
450 char *wp = w; | 450 char *wp = w; |
451 const char *s0 = s; | |
451 int ret = 0; | 452 int ret = 0; |
452 | 453 |
453 if (!w) | 454 if (!w) |
454 return AVERROR(ENOMEM); | 455 return AVERROR(ENOMEM); |
455 | 456 |
468 p.log_offset = log_offset; | 469 p.log_offset = log_offset; |
469 p.log_ctx = log_ctx; | 470 p.log_ctx = log_ctx; |
470 | 471 |
471 if ((ret = parse_expr(&e, &p)) < 0) | 472 if ((ret = parse_expr(&e, &p)) < 0) |
472 goto end; | 473 goto end; |
474 if (*p.s) { | |
475 av_log(&p, AV_LOG_ERROR, "Invalid chars '%s' at the end of expression '%s'\n", p.s, s0); | |
476 ret = AVERROR(EINVAL); | |
477 goto end; | |
478 } | |
473 if (!verify_expr(e)) { | 479 if (!verify_expr(e)) { |
474 av_free_expr(e); | 480 av_free_expr(e); |
475 ret = AVERROR(EINVAL); | 481 ret = AVERROR(EINVAL); |
476 goto end; | 482 goto end; |
477 } | 483 } |