diff options
-rw-r--r-- | print/zathura-pdf-mupdf/Makefile | 4 | ||||
-rw-r--r-- | print/zathura-pdf-mupdf/distinfo | 4 | ||||
-rw-r--r-- | print/zathura-pdf-mupdf/patches/patch-index.c | 49 | ||||
-rw-r--r-- | print/zathura-pdf-mupdf/patches/patch-links.c | 51 |
4 files changed, 105 insertions, 3 deletions
diff --git a/print/zathura-pdf-mupdf/Makefile b/print/zathura-pdf-mupdf/Makefile index 673f059db0c..32e864ea3a5 100644 --- a/print/zathura-pdf-mupdf/Makefile +++ b/print/zathura-pdf-mupdf/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.13 2017/02/12 06:25:56 ryoon Exp $ +# $NetBSD: Makefile,v 1.14 2017/02/18 13:38:33 leot Exp $ # DISTNAME= zathura-pdf-mupdf-0.3.1 -PKGREVISION= 2 +PKGREVISION= 3 CATEGORIES= print MASTER_SITES= http://pwmt.org/projects/zathura/plugins/download/ diff --git a/print/zathura-pdf-mupdf/distinfo b/print/zathura-pdf-mupdf/distinfo index 9e76e859908..e762ac6ff3b 100644 --- a/print/zathura-pdf-mupdf/distinfo +++ b/print/zathura-pdf-mupdf/distinfo @@ -1,7 +1,9 @@ -$NetBSD: distinfo,v 1.5 2017/01/31 10:12:02 leot Exp $ +$NetBSD: distinfo,v 1.6 2017/02/18 13:38:33 leot Exp $ SHA1 (zathura-pdf-mupdf-0.3.1.tar.gz) = ef37a181de96d6fca36db3ac818f790dcf3627ae RMD160 (zathura-pdf-mupdf-0.3.1.tar.gz) = 7497475ba55d2e7f96d23f378cbefeddd56089e4 SHA512 (zathura-pdf-mupdf-0.3.1.tar.gz) = 87b5b8a750a6911be37a0195b0f4bc3304350f9d29173091b3eeece40350b10cb98b009b2722a69ae1e617b4242292f3eba17fea97d5276e485069180f2bd67d Size (zathura-pdf-mupdf-0.3.1.tar.gz) = 9755 bytes SHA1 (patch-document.c) = b4695700ffc3a85667a292af059d0af58b3150f1 +SHA1 (patch-index.c) = fbf31d17bbf979a74160db6d6838a11ce47d37f1 +SHA1 (patch-links.c) = 58581cbe1468ddf9c0e5a58e80c16586977be49b diff --git a/print/zathura-pdf-mupdf/patches/patch-index.c b/print/zathura-pdf-mupdf/patches/patch-index.c new file mode 100644 index 00000000000..bf49be73674 --- /dev/null +++ b/print/zathura-pdf-mupdf/patches/patch-index.c @@ -0,0 +1,49 @@ +$NetBSD: patch-index.c,v 1.3 2017/02/18 13:38:33 leot Exp $ + +Avoid possible NULL-pointer dereference. + +--- index.c.orig 2017-01-11 21:21:14.000000000 +0000 ++++ index.c +@@ -51,24 +51,26 @@ build_index(fz_context* ctx, fz_document + zathura_link_type_t type = ZATHURA_LINK_INVALID; + zathura_rectangle_t rect = { .x1 = 0, .y1 = 0, .x2 = 0, .y2 = 0 }; + +- if (fz_is_external_link(ctx, outline->uri) == 1) { +- if (strstr(outline->uri, "file://") == outline->uri) { +- type = ZATHURA_LINK_GOTO_REMOTE; +- target.value = outline->uri; ++ if (outline->uri) { ++ if (fz_is_external_link(ctx, outline->uri) == 1) { ++ if (strstr(outline->uri, "file://") == outline->uri) { ++ type = ZATHURA_LINK_GOTO_REMOTE; ++ target.value = outline->uri; ++ } else { ++ type = ZATHURA_LINK_URI; ++ target.value = outline->uri; ++ } + } else { +- type = ZATHURA_LINK_URI; +- target.value = outline->uri; ++ float x = 0; ++ float y = 0; ++ ++ type = ZATHURA_LINK_GOTO_DEST; ++ target.destination_type = ZATHURA_LINK_DESTINATION_XYZ; ++ target.page_number = fz_resolve_link(ctx, document, outline->uri, &x, &y); ++ target.left = x; ++ target.top = y; ++ target.scale = 0.0; + } +- } else { +- float x = 0; +- float y = 0; +- +- type = ZATHURA_LINK_GOTO_DEST; +- target.destination_type = ZATHURA_LINK_DESTINATION_XYZ; +- target.page_number = fz_resolve_link(ctx, document, outline->uri, &x, &y); +- target.left = x; +- target.top = y; +- target.scale = 0.0; + } + + index_element->link = zathura_link_new(type, rect, target); diff --git a/print/zathura-pdf-mupdf/patches/patch-links.c b/print/zathura-pdf-mupdf/patches/patch-links.c new file mode 100644 index 00000000000..721f834064f --- /dev/null +++ b/print/zathura-pdf-mupdf/patches/patch-links.c @@ -0,0 +1,51 @@ +$NetBSD: patch-links.c,v 1.3 2017/02/18 13:38:33 leot Exp $ + +Avoid possible NULL-pointer dereference. + +--- links.c.orig 2017-01-11 21:21:14.000000000 +0000 ++++ links.c +@@ -43,25 +43,27 @@ pdf_page_links_get(zathura_page_t* page, + zathura_link_type_t type = ZATHURA_LINK_INVALID; + zathura_link_target_t target = { 0 }; + +- if (fz_is_external_link(mupdf_document->ctx, link->uri) == 1) { +- if (strstr(link->uri, "file://") == link->uri) { +- type = ZATHURA_LINK_GOTO_REMOTE; +- target.value = link->uri; ++ if (link->uri) { ++ if (fz_is_external_link(mupdf_document->ctx, link->uri) == 1) { ++ if (strstr(link->uri, "file://") == link->uri) { ++ type = ZATHURA_LINK_GOTO_REMOTE; ++ target.value = link->uri; ++ } else { ++ type = ZATHURA_LINK_URI; ++ target.value = link->uri; ++ } + } else { +- type = ZATHURA_LINK_URI; +- target.value = link->uri; ++ float x = 0; ++ float y = 0; ++ ++ type = ZATHURA_LINK_GOTO_DEST; ++ target.destination_type = ZATHURA_LINK_DESTINATION_XYZ; ++ target.page_number = fz_resolve_link(mupdf_document->ctx, ++ mupdf_document->document, link->uri, &x, &y); ++ target.left = x; ++ target.top = y; ++ target.scale = 0.0; + } +- } else { +- float x = 0; +- float y = 0; +- +- type = ZATHURA_LINK_GOTO_DEST; +- target.destination_type = ZATHURA_LINK_DESTINATION_XYZ; +- target.page_number = fz_resolve_link(mupdf_document->ctx, +- mupdf_document->document, link->uri, &x, &y); +- target.left = x; +- target.top = y; +- target.scale = 0.0; + } + + zathura_link_t* zathura_link = zathura_link_new(type, position, target); |