Fix 11053: Integer division by zero in calculate.h (#4092)
* Fix 11053: Integer division by zero in calculate.h * Format
This commit is contained in:
parent
69f09da63e
commit
be6daa94bb
|
@ -69,7 +69,7 @@ R calculate(const std::string& s, const T& x, const T& y, bool* error = nullptr)
|
|||
}
|
||||
return wrap(x / y);
|
||||
case '%':
|
||||
if (isZero(y)) {
|
||||
if (isZero(MathLib::bigint(y))) {
|
||||
if (error)
|
||||
*error = true;
|
||||
return R{};
|
||||
|
|
|
@ -6519,6 +6519,20 @@ private:
|
|||
|
||||
code = "void f(const char * const x) { !!system(x); }\n";
|
||||
valueOfTok(code, "x");
|
||||
|
||||
code = "void setDeltas(int life, int age, int multiplier) {\n"
|
||||
" int dx = 0;\n"
|
||||
" int dy = 0;\n"
|
||||
" if (age <= 2 || life < 4) {\n"
|
||||
" dy = 0;\n"
|
||||
" dx = (rand() % 3) - 1;\n"
|
||||
" }\n"
|
||||
" else if (age < (multiplier * 3)) {\n"
|
||||
" if (age % (int) (multiplier * 0.5) == 0) dy = -1;\n"
|
||||
" else dy = 0;\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
valueOfTok(code, "age");
|
||||
}
|
||||
|
||||
void valueFlowHang() {
|
||||
|
|
Loading…
Reference in New Issue