poppler/TextOutputDev.cc | 4 ++++ qt5/tests/check_search.cpp | 1 + qt6/tests/check_search.cpp | 1 + 3 files changed, 6 insertions(+)
New commits: commit d8fb21b78bc9f11d52491f90076737f484f69c7d Author: Albert Astals Cid <[email protected]> Date: Sat Nov 28 20:23:43 2020 +0100 Fix crash when searching things of length 0 diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc index eb37824e..451b4cb6 100644 --- a/poppler/TextOutputDev.cc +++ b/poppler/TextOutputDev.cc @@ -3816,6 +3816,10 @@ bool TextPage::findText(const Unicode *s, int len, bool startAtTop, bool stopAtB double xMin1, yMin1, xMax1, yMax1; bool found; + if (len == 0) { + return false; + } + if (rawOrder) { return false; } diff --git a/qt5/tests/check_search.cpp b/qt5/tests/check_search.cpp index 506588d2..56cb53fc 100644 --- a/qt5/tests/check_search.cpp +++ b/qt5/tests/check_search.cpp @@ -197,6 +197,7 @@ void TestSearch::testIgnoreDiacritics() // La cigogne a survolé nos têtes. // Der Storch flog über unsere Köpfe hinweg. + QCOMPARE(page->search(QString(), left, top, right, bottom, direction, mode0), false); QCOMPARE(page->search(QStringLiteral("ciguena"), left, top, right, bottom, direction, mode0), false); QCOMPARE(page->search(QStringLiteral("Ciguena"), left, top, right, bottom, direction, mode1), false); QCOMPARE(page->search(QStringLiteral("ciguena"), left, top, right, bottom, direction, mode1), true); diff --git a/qt6/tests/check_search.cpp b/qt6/tests/check_search.cpp index 56e5210b..c2ba3993 100644 --- a/qt6/tests/check_search.cpp +++ b/qt6/tests/check_search.cpp @@ -197,6 +197,7 @@ void TestSearch::testIgnoreDiacritics() // La cigogne a survolé nos têtes. // Der Storch flog über unsere Köpfe hinweg. + QCOMPARE(page->search(QString(), left, top, right, bottom, direction, mode0), false); QCOMPARE(page->search(QStringLiteral("ciguena"), left, top, right, bottom, direction, mode0), false); QCOMPARE(page->search(QStringLiteral("Ciguena"), left, top, right, bottom, direction, mode1), false); QCOMPARE(page->search(QStringLiteral("ciguena"), left, top, right, bottom, direction, mode1), true); _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
