tdf#100562 Add constraints for function DB

Constraints in http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part2.html#DB
were not all checked.

Change-Id: Ife9ff7ce73d239efd0a67625990493db770f0c20
Reviewed-on: https://gerrit.libreoffice.org/26606
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 2eae22b..ac20f10 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -1528,7 +1528,8 @@ void ScInterpreter::ScDB()
    double nRest = GetDouble();
    double nValue = GetDouble();
    if (nMonths < 1.0 || nMonths > 12.0 || nTimeLength > 1200.0 || nRest < 0.0 ||
        nPeriod > (nTimeLength + 1.0) || nRest > nValue || nValue < 0.0)
        nPeriod > (nTimeLength + 1.0) || nRest > nValue || nValue <= 0.0 ||
        nTimeLength <= 0 || nPeriod <= 0 )
    {
        PushIllegalArgument();
        return;