Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Factory:Rebuild
ebook-tools
0001-Avoid-crash-on-toc.ncx-navPoint-without-na...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Avoid-crash-on-toc.ncx-navPoint-without-navLabel.patch of Package ebook-tools
From 68869c7b5a0ba92d6cccdab5070e5ac4143aca81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de> 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
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor