Merge pull request #279 from duckduckgo/yegg/calc-fix

Calc fix to not allow runaway processing.
master
Gabriel Weinberg 2013-12-25 16:44:21 -08:00
commit 7711c13083
1 changed files with 2 additions and 0 deletions

View File

@ -94,6 +94,8 @@ handle query_nowhitespace => sub {
$tmp_expr =~ s/(?<!\.)(?<![0-9])0([1-9])/$1/;
eval {
# e.g. sin(100000)/100000 completely makes this go haywire.
alarm(1);
$tmp_result = eval($tmp_expr);
};