From 2b3bd1b7dbbf13f82b70587676809f189354c77a Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 5 May 2015 20:21:18 +0200 Subject: epub: Bail if rights.xml or encryption.xml are present (not DRM-free EPUB). --- source/html/epub-doc.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/html') diff --git a/source/html/epub-doc.c b/source/html/epub-doc.c index e77770ac..b7b24c42 100644 --- a/source/html/epub-doc.c +++ b/source/html/epub-doc.c @@ -203,6 +203,11 @@ epub_parse_header(fz_context *ctx, epub_document *doc) char ncx[2048], s[2048]; epub_chapter *head, *tail; + if (fz_has_archive_entry(ctx, zip, "META-INF/rights.xml")) + fz_throw(ctx, FZ_ERROR_GENERIC, "EPUB is locked by DRM"); + if (fz_has_archive_entry(ctx, zip, "META-INF/encryption.xml")) + fz_throw(ctx, FZ_ERROR_GENERIC, "EPUB is locked by DRM"); + /* parse META-INF/container.xml to find OPF */ buf = fz_read_archive_entry(ctx, zip, "META-INF/container.xml"); -- cgit v1.2.3