pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/print/zathura-pdf-mupdf Avoid possible NULL pointer de...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d305fdecb927
branches:  trunk
changeset: 358696:d305fdecb927
user:      leot <leot%pkgsrc.org@localhost>
date:      Sat Feb 18 13:38:33 2017 +0000

description:
Avoid possible NULL pointer dereferencies in `Index mode' for PDF with index
pointing to non-existing pages.

Bump PKGREVISION

diffstat:

 print/zathura-pdf-mupdf/Makefile              |   4 +-
 print/zathura-pdf-mupdf/distinfo              |   4 +-
 print/zathura-pdf-mupdf/patches/patch-index.c |  49 +++++++++++++++++++++++++
 print/zathura-pdf-mupdf/patches/patch-links.c |  51 +++++++++++++++++++++++++++
 4 files changed, 105 insertions(+), 3 deletions(-)

diffs (136 lines):

diff -r a5595ab7bec7 -r d305fdecb927 print/zathura-pdf-mupdf/Makefile
--- a/print/zathura-pdf-mupdf/Makefile  Sat Feb 18 13:18:46 2017 +0000
+++ b/print/zathura-pdf-mupdf/Makefile  Sat Feb 18 13:38:33 2017 +0000
@@ -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 -r a5595ab7bec7 -r d305fdecb927 print/zathura-pdf-mupdf/distinfo
--- a/print/zathura-pdf-mupdf/distinfo  Sat Feb 18 13:18:46 2017 +0000
+++ b/print/zathura-pdf-mupdf/distinfo  Sat Feb 18 13:38:33 2017 +0000
@@ -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 -r a5595ab7bec7 -r d305fdecb927 print/zathura-pdf-mupdf/patches/patch-index.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/print/zathura-pdf-mupdf/patches/patch-index.c     Sat Feb 18 13:38:33 2017 +0000
@@ -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 -r a5595ab7bec7 -r d305fdecb927 print/zathura-pdf-mupdf/patches/patch-links.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/print/zathura-pdf-mupdf/patches/patch-links.c     Sat Feb 18 13:38:33 2017 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index