From 778e641bccb7b78418ac8afb74f247095783fc1e Mon Sep 17 00:00:00 2001 From: Johannes Huber Date: Wed, 25 Jan 2017 17:32:49 +0100 Subject: kde-frameworks: Remove KDE Frameworks 5.26.0 Package-Manager: Portage-2.3.3, Repoman-2.3.1 --- ...ilemetadata-5.26.0-epubextractor-segfault.patch | 149 --------------------- ...filemetadata-5.26.0-odfextractor-segfault.patch | 66 --------- 2 files changed, 215 deletions(-) delete mode 100644 kde-frameworks/kfilemetadata/files/kfilemetadata-5.26.0-epubextractor-segfault.patch delete mode 100644 kde-frameworks/kfilemetadata/files/kfilemetadata-5.26.0-odfextractor-segfault.patch (limited to 'kde-frameworks/kfilemetadata/files') diff --git a/kde-frameworks/kfilemetadata/files/kfilemetadata-5.26.0-epubextractor-segfault.patch b/kde-frameworks/kfilemetadata/files/kfilemetadata-5.26.0-epubextractor-segfault.patch deleted file mode 100644 index b738d1ae09ac..000000000000 --- a/kde-frameworks/kfilemetadata/files/kfilemetadata-5.26.0-epubextractor-segfault.patch +++ /dev/null @@ -1,149 +0,0 @@ -From: Christoph Cullmann -Date: Sun, 11 Sep 2016 17:14:51 +0000 -Subject: Improve epub extractor, less segfaults -X-Git-Url: http://quickgit.kde.org/?p=kfilemetadata.git&a=commitdiff&h=47f6e57b2fa3768feb4f1f4a2cd3ce46660d90f2 ---- -Improve epub extractor, less segfaults - -Improve epub extractor: - -1) check for more nullpointers (e.g. data can be null for some fields, iterators, ...) -2) actually close the epub file again at all -3) iterator seems to handle clink as stated in docs, fix double free - -e.g. see bug 361727 -could be the double freed clink in the last iterator - -BUG: 361727 -REVIEW: 128888 ---- - - ---- a/src/extractors/epubextractor.cpp -+++ b/src/extractors/epubextractor.cpp -@@ -1,5 +1,6 @@ - /* - Copyright (C) 2013 Vishesh Handa -+ Copyright (C) 2016 Christoph Cullmann - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -46,11 +47,14 @@ - QString fetchMetadata(struct epub* e, const epub_metadata& type) - { - int size = 0; -- - unsigned char** data = epub_get_metadata(e, type, &size); - if (data) { - QStringList strList; - for (int i = 0; i < size; i++) { -+ // skip nullptr entries, can happen for broken xml files -+ if (!data[i]) -+ continue; -+ - strList << QString::fromUtf8((char*)data[i]); - free(data[i]); - } -@@ -65,7 +69,8 @@ - - void EPubExtractor::extract(ExtractionResult* result) - { -- struct epub* ePubDoc = epub_open(result->inputUrl().toUtf8().constData(), 1); -+ // open epub, return on exit, file will be closed again at end of function -+ auto ePubDoc = epub_open(result->inputUrl().toUtf8().constData(), 1); - if (!ePubDoc) { - qWarning() << "Invalid document"; - return; -@@ -138,49 +143,49 @@ - // - // Plain Text - // -- if (!(result->inputFlags() & ExtractionResult::ExtractPlainText)) { -- return; -+ if (result->inputFlags() & ExtractionResult::ExtractPlainText) { -+ if (auto iter = epub_get_iterator(ePubDoc, EITERATOR_SPINE, 0)) { -+ do { -+ char* curr = epub_it_get_curr(iter); -+ if (!curr) -+ continue; -+ -+ QString html = QString::fromUtf8(curr); -+ html.remove(QRegularExpression(QStringLiteral("<[^>]*>"))); -+ result->append(html); -+ } while (epub_it_get_next(iter)); -+ -+ epub_free_iterator(iter); -+ } -+ -+ auto tit = epub_get_titerator(ePubDoc, TITERATOR_NAVMAP, 0); -+ if (!tit) { -+ tit = epub_get_titerator(ePubDoc, TITERATOR_GUIDE, 0); -+ } -+ if (tit) { -+ if (epub_tit_curr_valid(tit)) { -+ do { -+ // get link, iterator handles freeing of it -+ char* clink = epub_tit_get_curr_link(tit); -+ -+ // epub_get_data returns -1 on failure -+ char* data = nullptr; -+ const int size = epub_get_data(ePubDoc, clink, &data); -+ if (size >= 0 && data) { -+ QString html = QString::fromUtf8(data, size); -+ // strip html tags -+ html.remove(QRegularExpression(QStringLiteral("<[^>]*>"))); -+ -+ result->append(html); -+ free(data); -+ } -+ } while (epub_tit_next(tit)); -+ } -+ epub_free_titerator(tit); -+ } - } - -- struct eiterator* iter = epub_get_iterator(ePubDoc, EITERATOR_SPINE, 0); -- do { -- char* curr = epub_it_get_curr(iter); -- if (!curr) -- continue; -- QString html = QString::fromUtf8(curr); -- html.remove(QRegularExpression(QStringLiteral("<[^>]*>"))); -- -- result->append(html); -- } while (epub_it_get_next(iter)); -- -- epub_free_iterator(iter); -- -- struct titerator* tit; -- -- tit = epub_get_titerator(ePubDoc, TITERATOR_NAVMAP, 0); -- if (!tit) { -- tit = epub_get_titerator(ePubDoc, TITERATOR_GUIDE, 0); -- } -- -- if (epub_tit_curr_valid(tit)) { -- do { -- char* clink = epub_tit_get_curr_link(tit); -- -- char* data; -- int size = epub_get_data(ePubDoc, clink, &data); -- free(clink); -- -- // epub_get_data returns -1 on failure -- if (size > 0 && data) { -- QString html = QString::fromUtf8(data, size); -- // strip html tags -- html.remove(QRegularExpression(QStringLiteral("<[^>]*>"))); -- -- result->append(html); -- free(data); -- } -- } while (epub_tit_next(tit)); -- } -- epub_free_titerator(tit); -+ // close epub file again -+ epub_close(ePubDoc); - } - - diff --git a/kde-frameworks/kfilemetadata/files/kfilemetadata-5.26.0-odfextractor-segfault.patch b/kde-frameworks/kfilemetadata/files/kfilemetadata-5.26.0-odfextractor-segfault.patch deleted file mode 100644 index 9f3029bdbb87..000000000000 --- a/kde-frameworks/kfilemetadata/files/kfilemetadata-5.26.0-odfextractor-segfault.patch +++ /dev/null @@ -1,66 +0,0 @@ -From: Christoph Cullmann -Date: Sun, 11 Sep 2016 13:07:47 +0000 -Subject: Make odf indexer more error prove, check if the files are there (and are files at all) (meta.xml + content.xml) -X-Git-Url: http://quickgit.kde.org/?p=kfilemetadata.git&a=commitdiff&h=40730d75397aefb92145f86fc6abc9b303c56cfe ---- -Make odf indexer more error prove, check if the files are there (and are files at all) (meta.xml + content.xml) - -REVIEW: 128886 -BUG 364748 - -=> if you download this odt's to indexed directories your baloo will die on each index, be careful ---- - - ---- a/src/extractors/odfextractor.cpp -+++ b/src/extractors/odfextractor.cpp -@@ -2,6 +2,7 @@ - - Copyright (C) 2013 Vishesh Handa - Copyright (C) 2012 Jörg Ehrichs -+ Copyright (C) 2016 Christoph Cullmann - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -59,19 +60,18 @@ - return; - } - -- const QStringList entries = directory->entries(); -- if (!entries.contains(QStringLiteral("meta.xml"))) { -+ // we need a meta xml file in the archive! -+ const auto metaXml = directory->entry(QStringLiteral("meta.xml")); -+ if (!metaXml || !metaXml->isFile()) { - qWarning() << "Invalid document structure (meta.xml is missing)"; - return; - } - - QDomDocument metaData(QStringLiteral("metaData")); -- const KArchiveFile* file = static_cast(directory->entry(QStringLiteral("meta.xml"))); -- metaData.setContent(file->data()); -+ metaData.setContent(static_cast(metaXml)->data()); - - // parse metadata ... - QDomElement docElem = metaData.documentElement(); -- - QDomNode n = docElem.firstChild().firstChild(); // ... ... content - while (!n.isNull()) { - QDomElement e = n.toElement(); -@@ -129,9 +129,14 @@ - return; - } - -- const KArchiveFile* contentsFile = static_cast(directory->entry(QStringLiteral("content.xml"))); -- QXmlStreamReader xml(contentsFile->createDevice()); -+ // for content indexing, we need content xml file -+ const auto contentXml = directory->entry(QStringLiteral("content.xml")); -+ if (!contentXml || !contentXml->isFile()) { -+ qWarning() << "Invalid document structure (content.xml is missing)"; -+ return; -+ } - -+ QXmlStreamReader xml(static_cast(contentXml)->createDevice()); - while (!xml.atEnd()) { - xml.readNext(); - if (xml.isCharacters()) { - -- cgit v1.2.3