Commit 94350ab9 authored by Mans Rullgard's avatar Mans Rullgard

eval: clear Parser instances before using

This prevents random values from the stack being used as
"variables" in expressions.
Signed-off-by: default avatarMans Rullgard <mans@mansr.com>
parent 74965f26
......@@ -461,7 +461,7 @@ int av_expr_parse(AVExpr **expr, const char *s,
const char * const *func2_names, double (* const *funcs2)(void *, double, double),
int log_offset, void *log_ctx)
{
Parser p;
Parser p = { 0 };
AVExpr *e = NULL;
char *w = av_malloc(strlen(s) + 1);
char *wp = w;
......@@ -506,7 +506,7 @@ end:
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
{
Parser p;
Parser p = { 0 };
p.const_values = const_values;
p.opaque = opaque;
......
......@@ -92,7 +92,7 @@ Evaluating 'st(1, 123); ld(1)'
'st(1, 123); ld(1)' -> 123.000000
Evaluating 'st(0, 1); while(lte(ld(0), 100), st(1, ld(1)+ld(0));st(0, ld(0)+1)); ld(1)'
'st(0, 1); while(lte(ld(0), 100), st(1, ld(1)+ld(0));st(0, ld(0)+1)); ld(1)' -> 5073.000000
'st(0, 1); while(lte(ld(0), 100), st(1, ld(1)+ld(0));st(0, ld(0)+1)); ld(1)' -> 4950.000000
Evaluating 'st(1, 1); st(2, 2); st(0, 1); while(lte(ld(0),10), st(3, ld(1)+ld(2)); st(1, ld(2)); st(2, ld(3)); st(0, ld(0)+1)); ld(3)'
'st(1, 1); st(2, 2); st(0, 1); while(lte(ld(0),10), st(3, ld(1)+ld(2)); st(1, ld(2)); st(2, ld(3)); st(0, ld(0)+1)); ld(3)' -> 144.000000
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment