diff --git a/src/xmlpatterns/expr/qunaryexpression.cpp b/src/xmlpatterns/expr/qunaryexpression.cpp index 1c4524e0d30a74e7ea7c8a2ada8faab9f73525c1..f99096b97a7bbb8b115f5d29bd55c35765bfa579 100644 --- a/src/xmlpatterns/expr/qunaryexpression.cpp +++ b/src/xmlpatterns/expr/qunaryexpression.cpp @@ -59,7 +59,10 @@ Item UnaryExpression::evaluateSingleton(const DynamicContext::Ptr &context) cons { const Item item(m_operand2->evaluateSingleton(context)); - if(item) + if (item) + // If the item is an untypedAtomic (or atomicString), the cast to Numeric will + // return a garbage object and will most likely cause a crash. + // There is simply no way to static cast from an instance of AtomicString to a Number. return item.as<Numeric>()->toNegated(); else return Item(); diff --git a/tests/auto/xmlpatternssdk/TestCase.cpp b/tests/auto/xmlpatternssdk/TestCase.cpp index a81cba944b9a48a996ff4dfc6b34cda02d0edbc3..d84ac06075e35e9c1ebae1f84568a95fdd55d183 100644 --- a/tests/auto/xmlpatternssdk/TestCase.cpp +++ b/tests/auto/xmlpatternssdk/TestCase.cpp @@ -77,6 +77,24 @@ TestResult::List TestCase::execute(const ExecutionStage stage, result.append(createTestResult(TestResult::Fail, QLatin1String("Skipped this test, we crash on it."))); return result; } + else if (name() == QLatin1String("op-numeric-unary-minus-1")) + { + TestResult::List result; + result.append(createTestResult(TestResult::Fail, QLatin1String("Skipped this test, we crash on it."))); + return result; + } + else if (name() == QLatin1String("emptyorderdecl-13")) + { + TestResult::List result; + result.append(createTestResult(TestResult::Fail, QLatin1String("Skipped this test, we crash on it."))); + return result; + } + else if (name() == QLatin1String("emptyorderdecl-21")) + { + TestResult::List result; + result.append(createTestResult(TestResult::Fail, QLatin1String("Skipped this test, we crash on it."))); + return result; + } qDebug() << "Running test case: " << name();