From d940388d7747fd3d816fbd7813567a843d30d969 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 14 Apr 2015 20:52:21 +0200 Subject: epub: Check version number and warn if it's not an EPUB 2.0 file. --- source/html/epub-doc.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source') diff --git a/source/html/epub-doc.c b/source/html/epub-doc.c index bd550e3d..2ea9f298 100644 --- a/source/html/epub-doc.c +++ b/source/html/epub-doc.c @@ -199,6 +199,7 @@ epub_parse_header(fz_context *ctx, epub_document *doc) fz_xml *package, *manifest, *spine, *itemref; char base_uri[2048]; const char *full_path; + const char *version; char ncx[2048], s[2048]; epub_chapter *head, *tail; @@ -228,6 +229,10 @@ epub_parse_header(fz_context *ctx, epub_document *doc) fz_drop_buffer(ctx, buf); package = fz_xml_find(content_opf, "package"); + version = fz_xml_att(package, "version"); + if (!version || strcmp(version, "2.0")) + fz_warn(ctx, "unknown epub version: %s", version ? version : ""); + manifest = fz_xml_find_down(package, "manifest"); spine = fz_xml_find_down(package, "spine"); -- cgit v1.2.3