Skip to content

Commit

Permalink
Fixed CORE-6355: TRUNC() does not accept second argument = -128
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPeshkoff committed Jul 8, 2020
1 parent 919dcaa commit fc6b04f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/jrd/SysFunction.cpp
Expand Up @@ -6012,13 +6012,14 @@ dsc* evlRound(thread_db* tdbb, const SysFunction* function, const NestValueArray
if (request->req_flags & req_null) // return NULL if scaleDsc is NULL
return NULL;

scale = -MOV_get_long(tdbb, scaleDsc, 0);
scale = MOV_get_long(tdbb, scaleDsc, 0);
if (!(scale >= MIN_SCHAR && scale <= MAX_SCHAR))
{
status_exception::raise(Arg::Gds(isc_expression_eval_err) <<
Arg::Gds(isc_sysf_invalid_scale) <<
Arg::Str(function->name));
}
scale = -scale;
}

// No sense in rounding to something more precise then arg
Expand Down Expand Up @@ -6132,13 +6133,14 @@ dsc* evlTrunc(thread_db* tdbb, const SysFunction* function, const NestValueArray
if (request->req_flags & req_null) // return NULL if scaleDsc is NULL
return NULL;

resultScale = -MOV_get_long(tdbb, scaleDsc, 0);
resultScale = MOV_get_long(tdbb, scaleDsc, 0);
if (!(resultScale >= MIN_SCHAR && resultScale <= MAX_SCHAR))
{
status_exception::raise(Arg::Gds(isc_expression_eval_err) <<
Arg::Gds(isc_sysf_invalid_scale) <<
Arg::Str(function->name));
}
resultScale = -resultScale;
}

if (value->isExact())
Expand Down

0 comments on commit fc6b04f

Please sign in to comment.