summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/gtk.scm14
-rw-r--r--gnu/packages/patches/gdk-pixbuf-CVE-2020-29385.patch53
3 files changed, 66 insertions, 2 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index ce30d1db1c..c0020fad41 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1056,6 +1056,7 @@ dist_patch_DATA = \
%D%/packages/patches/gdb-hurd.patch \
%D%/packages/patches/gd-fix-tests-on-i686.patch \
%D%/packages/patches/gd-brect-bounds.patch \
+ %D%/packages/patches/gdk-pixbuf-CVE-2020-29385.patch \
%D%/packages/patches/gdm-default-session.patch \
%D%/packages/patches/geary-CVE-2020-24661.patch \
%D%/packages/patches/genimage-signedness.patch \
diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index b9e81c9650..ee2c91264f 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -1,7 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2014, 2015, 2017, 2018, 2019 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2014, 2015, 2017, 2018, 2019, 2021 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
@@ -557,6 +557,7 @@ highlighting and other features typical of a source code editor.")
(package
(name "gdk-pixbuf")
(version "2.40.0")
+ (replacement gdk-pixbuf/fixed)
(source (origin
(method url-fetch)
(uri (string-append "mirror://gnome/sources/" name "/"
@@ -613,11 +614,20 @@ in the GNOME project.")
(license license:lgpl2.0+)
(home-page "https://developer.gnome.org/gdk-pixbuf/")))
+(define gdk-pixbuf/fixed
+ (package
+ (inherit gdk-pixbuf)
+ (source (origin
+ (inherit (package-source gdk-pixbuf))
+ (patches
+ (append (search-patches "gdk-pixbuf-CVE-2020-29385.patch")
+ (origin-patches (package-source gdk-pixbuf))))))))
+
;; To build gdk-pixbuf with SVG support, we need librsvg, and librsvg depends
;; on gdk-pixbuf, so this new varibale. Also, librsvg adds 90MiB to the
;; closure size.
(define-public gdk-pixbuf+svg
- (package (inherit gdk-pixbuf)
+ (package/inherit gdk-pixbuf
(name "gdk-pixbuf+svg")
(inputs
`(("librsvg" ,librsvg)
diff --git a/gnu/packages/patches/gdk-pixbuf-CVE-2020-29385.patch b/gnu/packages/patches/gdk-pixbuf-CVE-2020-29385.patch
new file mode 100644
index 0000000000..e6ac4de00b
--- /dev/null
+++ b/gnu/packages/patches/gdk-pixbuf-CVE-2020-29385.patch
@@ -0,0 +1,53 @@
+Fix CVE-2020-29385. Note that we omit the binary test file
+tests/test-images/fail/hang_114.gif from the following commit, to avoid
+requiring 'git' to apply the patch.
+
+
+From bdd3acbd48a575d418ba6bf1b32d7bda2fae1c81 Mon Sep 17 00:00:00 2001
+From: Robert Ancell <robert.ancell@canonical.com>
+Date: Mon, 30 Nov 2020 12:26:12 +1300
+Subject: [PATCH] gif: Fix LZW decoder accepting invalid LZW code.
+
+The code value after a reset wasn't being validated, which means we would
+accept invalid codes. This could cause an infinite loop in the decoder.
+
+Fixes CVE-2020-29385
+
+Fixes https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/issues/164
+---
+ gdk-pixbuf/lzw.c | 13 +++++++------
+ tests/test-images/fail/hang_114.gif | Bin 0 -> 5561 bytes
+ 2 files changed, 7 insertions(+), 6 deletions(-)
+ create mode 100644 tests/test-images/fail/hang_114.gif
+
+diff --git a/gdk-pixbuf/lzw.c b/gdk-pixbuf/lzw.c
+index 9e052a6f7..105daf2b1 100644
+--- a/gdk-pixbuf/lzw.c
++++ b/gdk-pixbuf/lzw.c
+@@ -195,19 +195,20 @@ lzw_decoder_feed (LZWDecoder *self,
+ if (self->last_code != self->clear_code && self->code_table_size < MAX_CODES) {
+ if (self->code < self->code_table_size)
+ add_code (self, self->code);
+- else if (self->code == self->code_table_size)
++ else
+ add_code (self, self->last_code);
+- else {
+- /* Invalid code received - just stop here */
+- self->last_code = self->eoi_code;
+- return output_length;
+- }
+
+ /* When table is full increase code size */
+ if (self->code_table_size == (1 << self->code_size) && self->code_size < LZW_CODE_MAX)
+ self->code_size++;
+ }
+
++ /* Invalid code received - just stop here */
++ if (self->code >= self->code_table_size) {
++ self->last_code = self->eoi_code;
++ return output_length;
++ }
++
+ /* Convert codeword into indexes */
+ n_written += write_indexes (self, output + n_written, output_length - n_written);
+ }