~ruther/guix-local

e8fc1a0dcf6901f19f26e5277ed32d626c20cf08 — Marius Bakke 9 years ago f1a892c
gnu: libevent: Update to 2.1.8 [security fixes].

* gnu/packages/libevent.scm (libevent): Update to 2.1.8.
[inputs]: Change 'python-wrapper' to 'python-2'. Move 'which' to ...
[native-inputs]: ... here. New field.
(libevent-2.0): New variable.
* gnu/packages/patches/libevent-2.1-dns-tests.patch,
  gnu/packages/patches/libevent-2.0-evdns-fix-remote-stack-overread.patch
  gnu/packages/patches/libevent-2.0-evdns-fix-searching-empty-hostnames.patch
  gnu/packages/patches/libevent-2.0-evutil-fix-buffer-overflow.patch: New files.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/gnuzilla.scm (icecat)[inputs]: Change 'libevent' to 'libevent-2.0'.
M gnu/local.mk => gnu/local.mk +4 -0
@@ 672,6 672,10 @@ dist_patch_DATA =						\
  %D%/packages/patches/libdrm-symbol-check.patch		\
  %D%/packages/patches/libepoxy-gl-null-checks.patch		\
  %D%/packages/patches/libevent-dns-tests.patch			\
  %D%/packages/patches/libevent-2.0-evdns-fix-remote-stack-overread.patch	\
  %D%/packages/patches/libevent-2.0-evdns-fix-searching-empty-hostnames.patch	\
  %D%/packages/patches/libevent-2.0-evutil-fix-buffer-overflow.patch	\
  %D%/packages/patches/libevent-2.1-dns-tests.patch		\
  %D%/packages/patches/libextractor-ffmpeg-3.patch		\
  %D%/packages/patches/libjxr-fix-function-signature.patch	\
  %D%/packages/patches/libjxr-fix-typos.patch			\

M gnu/packages/gnuzilla.scm => gnu/packages/gnuzilla.scm +1 -1
@@ 441,7 441,7 @@ standards.")
       ("libgnome" ,libgnome)
       ("libjpeg-turbo" ,libjpeg-turbo)
       ("libxft" ,libxft)
       ("libevent" ,libevent)
       ("libevent" ,libevent-2.0)
       ("libxinerama" ,libxinerama)
       ("libxscrnsaver" ,libxscrnsaver)
       ("libxcomposite" ,libxcomposite)

M gnu/packages/libevent.scm => gnu/packages/libevent.scm +25 -6
@@ 3,6 3,7 @@
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015 Eric Dvorsak <eric@dvorsak.fr>
;;; Copyright © 2016 David Thompson <davet@gnu.org>
;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
;;;
;;; This file is part of GNU Guix.
;;;


@@ 33,7 34,7 @@
(define-public libevent
  (package
    (name "libevent")
    (version "2.0.22")
    (version "2.1.8")
    (source (origin
             (method url-fetch)
             (uri (string-append


@@ 41,13 42,13 @@
                   version "-stable/libevent-" version "-stable.tar.gz"))
             (sha256
              (base32
               "18qz9qfwrkakmazdlwxvjmw8p76g70n3faikwvdwznns1agw9hki"))
             (patches (search-patches "libevent-dns-tests.patch"))))
               "1hhxnxlr0fsdv7bdmzsnhdz16fxf3jg2r6vyljcl3kj6pflcap4n"))
             (patches (search-patches "libevent-2.1-dns-tests.patch"))))
    (build-system gnu-build-system)
    (inputs
     `(;; Dependencies used for the tests and for `event_rpcgen.py'.
       ("which" ,which)
       ("python" ,python-wrapper)))
     `(("python" ,python-2)))           ; for 'event_rpcgen.py'
    (native-inputs
     `(("which" ,which)))
    (home-page "http://libevent.org/")
    (synopsis "Event notification library")
    (description


@@ 62,6 63,24 @@ then add or remove events dynamically without having to change the event
loop.")
    (license bsd-3)))

(define-public libevent-2.0
  (package
    (inherit libevent)
    (version "2.0.22")
    (source (origin
          (method url-fetch)
          (uri (string-append
                "https://github.com/libevent/libevent/releases/download/release-"
                version "-stable/libevent-" version "-stable.tar.gz"))
          (sha256
           (base32
            "18qz9qfwrkakmazdlwxvjmw8p76g70n3faikwvdwznns1agw9hki"))
          (patches (search-patches
                    "libevent-dns-tests.patch"
                    "libevent-2.0-evdns-fix-remote-stack-overread.patch"
                    "libevent-2.0-evutil-fix-buffer-overflow.patch"
                    "libevent-2.0-evdns-fix-searching-empty-hostnames.patch"))))))

(define-public libev
  (package
    (name "libev")

A gnu/packages/patches/libevent-2.0-evdns-fix-remote-stack-overread.patch => gnu/packages/patches/libevent-2.0-evdns-fix-remote-stack-overread.patch +42 -0
@@ 0,0 1,42 @@
Fix buffer overread in libevents DNS code.

Upstream bug report:

https://github.com/libevent/libevent/issues/317

Patch copied from upstream source repository:

https://github.com/libevent/libevent/commit/96f64a022014a208105ead6c8a7066018449d86d

From 3c570970516f48da35f42fef98276531fcc0abaa Mon Sep 17 00:00:00 2001
From: Azat Khuzhin <a3at.mail@gmail.com>
Date: Mon, 1 Feb 2016 17:32:09 +0300
Subject: [PATCH] evdns: name_parse(): fix remote stack overread

---
 evdns.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/evdns.c b/evdns.c
index 60b10485..137c24ea 100644
--- a/evdns.c
+++ b/evdns.c
@@ -960,7 +960,6 @@ name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {
 
 	for (;;) {
 		u8 label_len;
-		if (j >= length) return -1;
 		GET8(label_len);
 		if (!label_len) break;
 		if (label_len & 0xc0) {
@@ -981,6 +980,7 @@ name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {
 			*cp++ = '.';
 		}
 		if (cp + label_len >= end) return -1;
+		if (j + label_len > length) return -1;
 		memcpy(cp, packet + j, label_len);
 		cp += label_len;
 		j += label_len;
-- 
2.11.0


A gnu/packages/patches/libevent-2.0-evdns-fix-searching-empty-hostnames.patch => gnu/packages/patches/libevent-2.0-evdns-fix-searching-empty-hostnames.patch +40 -0
@@ 0,0 1,40 @@
Fix OOB read on empty hostnames in evdns.

Upstream bug report:

https://github.com/libevent/libevent/issues/332

Patch copied from upstream source repository:

https://github.com/libevent/libevent/commit/ec65c42052d95d2c23d1d837136d1cf1d9ecef9e

From a0305cec166a5bc89f1eb362510cc4cd25ecc0bc Mon Sep 17 00:00:00 2001
From: Azat Khuzhin <a3at.mail@gmail.com>
Date: Fri, 25 Mar 2016 00:33:47 +0300
Subject: [PATCH] evdns: fix searching empty hostnames

---
 evdns.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/evdns.c b/evdns.c
index 137c24ea..6191c677 100644
--- a/evdns.c
+++ b/evdns.c
@@ -3122,9 +3122,12 @@ search_set_from_hostname(struct evdns_base *base) {
 static char *
 search_make_new(const struct search_state *const state, int n, const char *const base_name) {
 	const size_t base_len = strlen(base_name);
-	const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
+	char need_to_append_dot;
 	struct search_domain *dom;
 
+	if (!base_len) return NULL;
+	need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
+
 	for (dom = state->head; dom; dom = dom->next) {
 		if (!n--) {
 			/* this is the postfix we want */
-- 
2.11.0


A gnu/packages/patches/libevent-2.0-evutil-fix-buffer-overflow.patch => gnu/packages/patches/libevent-2.0-evutil-fix-buffer-overflow.patch +42 -0
@@ 0,0 1,42 @@
Fix buffer overflow in evutil.

Upstream bug report:

https://github.com/libevent/libevent/issues/318

Patch copied from upstream source repository:

https://github.com/libevent/libevent/commit/329acc18a0768c21ba22522f01a5c7f46cacc4d5

From 28bdc2f3f62259d21ccaf7be2b60ef0a53e6f342 Mon Sep 17 00:00:00 2001
From: Azat Khuzhin <a3at.mail@gmail.com>
Date: Sun, 31 Jan 2016 00:57:16 +0300
Subject: [PATCH] evutil_parse_sockaddr_port(): fix buffer overflow

---
 evutil.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/evutil.c b/evutil.c
index 33445170..e2dfe6e4 100644
--- a/evutil.c
+++ b/evutil.c
@@ -1808,12 +1808,12 @@ evutil_parse_sockaddr_port(const char *ip_as_string, struct sockaddr *out, int *
 
 	cp = strchr(ip_as_string, ':');
 	if (*ip_as_string == '[') {
-		int len;
+		size_t len;
 		if (!(cp = strchr(ip_as_string, ']'))) {
 			return -1;
 		}
-		len = (int) ( cp-(ip_as_string + 1) );
-		if (len > (int)sizeof(buf)-1) {
+		len = ( cp-(ip_as_string + 1) );
+		if (len > sizeof(buf)-1) {
 			return -1;
 		}
 		memcpy(buf, ip_as_string+1, len);
-- 
2.11.0


A gnu/packages/patches/libevent-2.1-dns-tests.patch => gnu/packages/patches/libevent-2.1-dns-tests.patch +26 -0
@@ 0,0 1,26 @@
Disable tests that rely on usable DNS lookups, which aren't available
in build chroots.

--- libevent-2.0.21-stable/test/regress_dns.c	2013-01-20 22:32:09.000000000 +0100
+++ libevent-2.0.21-stable/test/regress_dns.c	2013-01-20 22:32:30.000000000 +0100
@@ -2120,10 +2120,6 @@
 
 struct testcase_t dns_testcases[] = {
 	DNS_LEGACY(server, TT_FORK|TT_NEED_BASE),
-	DNS_LEGACY(gethostbyname, TT_FORK|TT_NEED_BASE|TT_NEED_DNS|TT_OFF_BY_DEFAULT),
-	DNS_LEGACY(gethostbyname6, TT_FORK|TT_NEED_BASE|TT_NEED_DNS|TT_OFF_BY_DEFAULT),
-	DNS_LEGACY(gethostbyaddr, TT_FORK|TT_NEED_BASE|TT_NEED_DNS|TT_OFF_BY_DEFAULT),
-	{ "resolve_reverse", dns_resolve_reverse, TT_FORK|TT_OFF_BY_DEFAULT, NULL, NULL },
 	{ "search_empty", dns_search_empty_test, TT_FORK|TT_NEED_BASE, &basic_setup, NULL },
 	{ "search", dns_search_test, TT_FORK|TT_NEED_BASE, &basic_setup, NULL },
 	{ "search_lower", dns_search_lower_test, TT_FORK|TT_NEED_BASE, &basic_setup, NULL },
@@ -2163,9 +2159,6 @@
 
 	{ "client_fail_requests", dns_client_fail_requests_test,
 	  TT_FORK|TT_NEED_BASE, &basic_setup, NULL },
-	{ "client_fail_requests_getaddrinfo",
-	  dns_client_fail_requests_getaddrinfo_test,
-	  TT_FORK|TT_NEED_BASE, &basic_setup, NULL },
 
 	END_OF_TESTCASES
 };