Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ebook-tools for openSUSE:Factory checked in at 2023-04-24 22:30:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ebook-tools (Old) and /work/SRC/openSUSE:Factory/.ebook-tools.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ebook-tools" Mon Apr 24 22:30:47 2023 rev:23 rq:1082271 version:0.2.2 Changes: -------- --- /work/SRC/openSUSE:Factory/ebook-tools/ebook-tools.changes 2021-01-15 19:43:39.841783698 +0100 +++ /work/SRC/openSUSE:Factory/.ebook-tools.new.1533/ebook-tools.changes 2023-04-24 22:30:48.375365485 +0200 @@ -1,0 +2,9 @@ +Sun Apr 23 03:21:07 UTC 2023 - Stefan Brüns <[email protected]> + +- Fix a crash when an itemref in the spine has no idref, + see kde#466540. + * add 0002-Avoid-crash-on-spine-itemref-without-idref.patch +- Replace 0001-Avoid-crash-on-toc-navPoint-without-navLabel.patch + with 0001-Avoid-crash-on-toc.ncx-navPoint-without-navLabel.patch + +------------------------------------------------------------------- Old: ---- 0001-Avoid-crash-on-toc-navPoint-without-navLabel.patch New: ---- 0001-Avoid-crash-on-toc.ncx-navPoint-without-navLabel.patch 0002-Avoid-crash-on-spine-itemref-without-idref.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ebook-tools.spec ++++++ --- /var/tmp/diff_new_pack.H7VfZe/_old 2023-04-24 22:30:48.879368481 +0200 +++ /var/tmp/diff_new_pack.H7VfZe/_new 2023-04-24 22:30:48.883368505 +0200 @@ -1,7 +1,7 @@ # # spec file for package ebook-tools # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -28,7 +28,9 @@ Patch1: ebook-tools-64bit-installation.diff Patch2: ebook-tools-visibility-hidden.patch # PATCH-FIX-OPENSUSE - fix https://sourceforge.net/p/ebook-tools/bugs/8/ -Patch3: 0001-Avoid-crash-on-toc-navPoint-without-navLabel.patch +Patch3: 0001-Avoid-crash-on-toc.ncx-navPoint-without-navLabel.patch +# PATCH-FIX-OPENSUSE +Patch4: 0002-Avoid-crash-on-spine-itemref-without-idref.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: pkgconfig @@ -58,7 +60,8 @@ %setup -q %patch1 -p1 %patch2 -%patch3 -p2 +%patch3 -p1 +%patch4 -p1 %build %cmake ++++++ 0001-Avoid-crash-on-toc.ncx-navPoint-without-navLabel.patch ++++++ >From 68869c7b5a0ba92d6cccdab5070e5ac4143aca81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <[email protected]> Date: Tue, 30 Apr 2019 16:36:09 +0200 Subject: [PATCH 1/2] Avoid crash on toc.ncx navPoint without navLabel Althoug at least one navLabel is required per navPoint, there is no guarantee it actually exists. Avoid crashes due to invalid accesses of a null label in case the toc is broken, and spew a warning. Fixes #8 epub_tit_next crashes on navPoint without navLabel. --- src/libepub/epub.c | 5 +++-- src/libepub/opf.c | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libepub/epub.c b/src/libepub/epub.c index d085503..a259d9d 100644 --- a/src/libepub/epub.c +++ b/src/libepub/epub.c @@ -469,8 +469,9 @@ int epub_tit_next(struct titerator *tit) { case TITERATOR_NAVMAP: case TITERATOR_PAGES: ti = GetNodeData(curr); - tit->cache.label = - (char *)_opf_label_get_by_doc_lang(tit->epub->opf, ti->label); + if (ti->label) + tit->cache.label = + (char *)_opf_label_get_by_doc_lang(tit->epub->opf, ti->label); if (! tit->cache.label) tit->cache.label = (char *)ti->id; diff --git a/src/libepub/opf.c b/src/libepub/opf.c index 34145b9..ae41184 100644 --- a/src/libepub/opf.c +++ b/src/libepub/opf.c @@ -394,6 +394,10 @@ void _opf_parse_navmap(struct opf *opf, xmlTextReaderPtr reader) { } else if (xmlTextReaderNodeType(reader) == 15) { if (item) { + if (! item->label) { + _epub_print_debug(opf->epub, DEBUG_WARNING, + "- missing navlabel for nav point element"); + } _epub_print_debug(opf->epub, DEBUG_INFO, "adding nav point item->%s %s (d:%d,p:%d)", item->id, item->src, item->depth, item->playOrder); -- 2.40.0 ++++++ 0002-Avoid-crash-on-spine-itemref-without-idref.patch ++++++ >From 37ccdd11e30ea60225276cbfaba4cdd483f9f6fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <[email protected]> Date: Sun, 23 Apr 2023 05:16:20 +0200 Subject: [PATCH 2/2] Avoid crash on spine itemref without idref Although the idref attribute is required, it may be missing in a malformed epub file. Warn during parsing, and skip the node when linearizing. Return a non-null empty string in case the iterator points to an invalid element but not the last one, otherwise the iteration is stopped. --- src/libepub/epub.c | 9 ++++++++- src/libepub/opf.c | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libepub/epub.c b/src/libepub/epub.c index a259d9d..956c7c5 100644 --- a/src/libepub/epub.c +++ b/src/libepub/epub.c @@ -255,6 +255,12 @@ char *_get_spine_it_url(struct eiterator *it) { return NULL; data = GetNodeData(it->curr); + if (!((struct spine *)data)->idref) { + _epub_print_debug(it->epub, DEBUG_INFO, + "skipping spine itemref without idref"); + return NULL; + } + tmp = _opf_manifest_get_by_id(it->epub->opf, ((struct spine *)data)->idref); if (!tmp) { @@ -375,7 +381,8 @@ char *epub_it_get_next(struct eiterator *it) { break; } - return epub_it_get_curr(it); + epub_it_get_curr(it); + return it->cache ? it->cache : it->curr ? "" : NULL; } int epub_close(struct epub *epub) { diff --git a/src/libepub/opf.c b/src/libepub/opf.c index ae41184..3eba55c 100644 --- a/src/libepub/opf.c +++ b/src/libepub/opf.c @@ -701,6 +701,10 @@ void _opf_parse_spine(struct opf *opf, xmlTextReaderPtr reader) { memset(item, 0, sizeof(struct spine)); item->idref = xmlTextReaderGetAttribute(reader, (xmlChar *)"idref"); + if (!item->idref) { + _epub_print_debug(opf->epub, DEBUG_WARNING, + "- missing idref in spine itemref"); + } linear = xmlTextReaderGetAttribute(reader, (xmlChar *)"linear"); if (linear && xmlStrcasecmp(linear, (xmlChar *)"no") == 0) { item->linear = 0; -- 2.40.0
