bug-libmatheval
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Bug-libmatheval] segmentation fault using matheval


From: Ferrarese Leopoldo
Subject: RE: [Bug-libmatheval] segmentation fault using matheval
Date: Fri, 30 Jul 2004 12:18:49 +0200

Hi,

>Thanks for the problem report.  There exist no global variables in
>library so it should be fully thread-safe.  Could you please try
>problematic functions with test program utilizing your function that I'm
>attaching to this message and then let me know of input that will make
>problem to appear?  Regarding segfaulting - I hope you allocated large
>enough buffer for res argument (would suggest using snprintf() instead
>of sprintf() anyway)?  Further, evaluator_create() will return NULL if
>string passed to this function is invalid regarding allowed syntax (see
>evaluator_create() node in library documentation for explanation what is
>allowed).
>Regards,
>Alex

Thank you, for the code, but I haven't a problem with the lenght of the string 
buffer.
I think to isolate an input case, and I investigate:
if use correct function, all is ok.
but when I use "log(2)^^2", in this case the first evaluator_create failed, ok, 
is correct, 
but all the next functions fail!

Now I think to resolv the problem in this way:
1) in main function,I create a pointer with a simple function:
function_safe=evaluator_create("1+1\0");
2) in calcola function if evaluator_create failed, I call the 
evaluator_destroy(function_safe);
3) recall the function_safe=evaluator_create("1+1\0");

I don't know why.. but this solution works...
:)

there isn't a function to initializate all???

If you want try were I use the matheval, follow this link:
http://search.virgilio.it/search/cgi/search.cgi?f=hv&switch=0&offset=0&hits=10&qs=1%2B1


Leo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]