[FFmpeg-devel] [PATCH] Make parse_primary() fails if the expression string is interpreted as a number and evaluated with av_strtod(), but only the first part of the string is parsed.
Michael Niedermayer
michaelni
Thu Jun 10 02:06:33 CEST 2010
On Wed, Jun 09, 2010 at 11:49:24PM +0200, Stefano Sabatini wrote:
> ---
> libavutil/eval.c | 22 ++++++++++++++++++++++
> 1 files changed, 22 insertions(+), 0 deletions(-)
>
> diff --git a/libavutil/eval.c b/libavutil/eval.c
> index 59ebd94..cd4ea26 100644
> --- a/libavutil/eval.c
> +++ b/libavutil/eval.c
> @@ -191,6 +191,10 @@ static int parse_primary(AVExpr **e, Parser *p)
> /* number */
> d->value = av_strtod(p->s, &next);
> if (next != p->s) {
> + if (*next) {
> + av_log(p, AV_LOG_ERROR, "Expected number but found '%s'\n", p->s);
> + return AVERROR(EINVAL);
> + }
> d->type = e_value;
> p->s= next;
> *e = d;
> @@ -526,6 +530,24 @@ int main(void)
> {
> int i;
> double d;
> + const char **expr, *exprs[] = {
> + "",
> + "foo",
> + "1",
> + "1foo",
> + "foo1",
> + "1gi",
> + "1Gi",
this is a quite limited set of things tested
() + - * / sin() PI E ... should be tested too
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100610/5613f723/attachment.pgp>
More information about the ffmpeg-devel
mailing list