Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

long type promption error #162

Closed
killme2008 opened this issue Sep 10, 2019 · 2 comments
Closed

long type promption error #162

killme2008 opened this issue Sep 10, 2019 · 2 comments
Labels
Milestone

Comments

@killme2008
Copy link
Owner

killme2008 commented Sep 10, 2019

发现个bug: com.googlecode.aviator.lexer.ExpressionLexer 类 第263 - 269 行: // if the long value is out of range,then it must be negative, so // we make it as a big integer. if (lval < 0) { value = new BigInteger(sb.toString()); } else { value = lval; } 这里提到 :如果值 超过了 long.max_value , 则会把源值通过 BigInteger 来封装,前提是 lval < 0 。 经测试发现: AviatorEvaluator.execute("20190622154026220130025363") , 此时 lval = -3317435537657544813 , 此时会处理为 new BigInteger("20190622154026220130025363") , 这种情况下,没问题。 AviatorEvaluator.execute("2017122615550747128008704"),此时 lval = 8044578755077902336 , 这种情况下则出问题了,因为 lval > 0 , 不会对源值进行 BigInteger 封装,而是直接把 lval = 8044578755077902336 做为结果输出了。

@killme2008
Copy link
Owner Author

refer https://www.oschina.net/p/aviator

@killme2008
Copy link
Owner Author

@killme2008 killme2008 added this to the 4.2.4 milestone Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant